Chat system

Will Ware wware at world.std.com
Sat Mar 18 23:09:47 EST 2000


Cliff Crawford (cjc26 at nospam.cornell.edu) wrote:
> Hmm, from what I understand if one microthread does a read on a socket
> or something, and it blocks, then the entire process (including all
> other running microthreads) will hang until the call to read returns.
> So I think you would need to set both curses and your socket to be
> non-blocking for this to work..?

That's right. Microthreads all run within a single OS thread, and if
the OS thread blocks, all the microthreads are hosed. If you can find
a non-blocking test of the condition (which would normally cause you
to block), you'll be able to write something where the only microthreads
that block are the ones waiting for that particular resource. You may
end up needing to create one thread that runs in a loop, constantly
monitoring the condition so that it can unblock other threads as
required. In some cases you'll be lucky, and have a very specific
event upon which threads should unblock.
-- 
 - - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware	email:    wware @ world.std.com



More information about the Python-list mailing list