A lock that times out but doesn't poll

Peter Hansen peter at engcorp.com
Sun Nov 28 09:19:33 EST 2004


Jive wrote:
> 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.

"Instantly" is of course impossible, even with a language
faster than Python.  You probably have some specific maximum
latency in mind.  And maybe this is a hard realtime system
and maybe it's not.

Python, of course, is unsuitable for many hard realtime systems,
and if you're using Windows you are probably on the wrong platform
in the first place.  (Just on Friday we were doing a little bit
of latency measurement in a similar situation.  97 times out of
100 the Python code on a fast WinXP machine was taking less than
the required 0.35 seconds to respond and finish its processing.
Once it took 0.37 seconds, once it took 0.85 seconds, and once
it took just over 1.0 seconds.  Windows....)

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

The bar for putting things in the main distribution should be
very, very high.  One of the conditions for doing that should
probably be that the code is fairly widely used and widely
required.  It's not apparent that this is yet the case.

Why not post it to an appropriate "recipe" page in the fledgling
Agile Control Forum site instead?  (http://www.engcorp.com/acf)
That way others who *do* work in the machine control field will
have an early chance to try out your code, experiment, maybe
even improve it, fix bugs, and basically do some of the work that
*should* be done before anything gets into the main Python distro...

-Peter



More information about the Python-list mailing list