A lock that times out but doesn't poll

David Bolen db3l at fitlinxx.com
Fri Nov 26 20:52:54 CET 2004


"Jive" <someone at microsoft.com> writes:

> I did find the MS-Windows timed lock extension though.

That's pretty much what I use when I need them (at least under
Windows).  For example, in a recent application I had a serious need
for low latency events and minimizing CPU while blocked.  Switching
from the threading.Event to a Win32 event object was a big win on both
fronts, and are pretty drop-in in terms of functionality.  I imagine
there is something similar in pthreads, but have not had the need
there yet.

Probably the best way to support this sort of thing in Python itself
is with OS-specific blocks for cases which are easy to do and fall
back to the current implementation in others.  But as has been posted
here before, that needs someone to make, test and then propose the
changes.

-- David



More information about the Python-list mailing list