[Python-Dev] POSIX thread code
Aahz
aahz@pythoncraft.com
Mon, 18 Mar 2002 18:02:59 -0500
On Mon, Mar 18, 2002, Guido van Rossum wrote:
>
> Yeah, unfortunately the only implementation technique I have to offer
> right now is to turn all acquire calls internally into a loop around
> an acquire call with a timeout in the order of 1 second, and to check
> signals each time around the loop. :-(
-1
The problem with this is that you really start tying yourself in knots.
If you do a time.sleep() for one second, that can't be interrupted for a
full second, either on keyboard interrupt or on releasing the lock. The
finer-grained you go on time.sleep(), the more overhead you consume, and
the coarser-grained you go, the more you limit throughput.
I'm not aware of any good cross-platform technique for managing thread
timeouts that is also "live".
--
Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/
The best way to get information on Usenet is not to ask a question, but
to post the wrong information. --Aahz