A lock that times out but doesn't poll

Jive someone at microsoft.com
Sat Nov 27 18:53:10 EST 2004


"David Bolen" <db3l at fitlinxx.com> wrote in message
news:uis7sxu95.fsf at fitlinxx.com...
> "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

Ah ha!  You understand.  I live and breath this stuff.  You too?

Here is a common example from my line of work: You set a piece of machinery
into motion.  If everything is operating normally, it will reach a certain
point and interrupt a light beam.  You must react to that event instantly.
However, if it has not interrupted the beam after some longer time, you must
wake up because something is wrong.

> 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.

I would ammend that to read, "fall back on an improvement of the current
implementation," but otherwise I agree.

A year ago I volunteered (on this group) to do the general work, and the
specific module for Windoze.  I was told,  "Just post your cute little code
to some free software repository somewhere."  At least that's the way I felt
at the time. Of course, no one here knows "Jive" from Adam.  There is a
tendency on the net to assume anyone you don't recognise is a clueless
newbie, and everything they post is naive blather. I've been cruising and
using the newsgroups under one name or another since the mid 80's.

So where was I before I went off into old fart mode?  Oh yeah.  It really
should go into the main Python distribution.





More information about the Python-list mailing list