WaitForMultipleObjects in Python.

Peter Hansen peter at engcorp.com
Thu Jul 8 17:13:42 EDT 2004


Tim Golden wrote:

> | Tim Golden <tim.golden at viacom-outdoor.co.uk> wrote in message 
> | news:<mailman.103.1089282296.5135.python-list at python.org>...
> | > | Is there any way to wait in multiple events, semaphores etc. For
> | > | examole on Queue and Event? Like you can do in WIN32.
> | > 
> | > If you haven't already, install the pywin32 extensions from
> | > http://starship.python.net/crew/mhammond/win32/Downloads.html
> | > 
> | > and look at the win32event module
> |
> | I mean portable with no win32. 
> | 
> | Speaking of win32event. Can I use WaitForMultipleObjects with 
> | Python Event object?
> 
> Ah. I'm perfectly certain that you can do or simulate all those
> sort of things. And it's possible that someone's already done it,
> but if they haven't it won't be trivial. (And if they have, it 
> probably wasn't trivial).

I'm perfectly _uncertain_ that it's possible.  Doesn't support for
that require some sort of unified mechanism right at the OS level?
All the ways of "waiting" in Python probably use Python or C code
wrapped around various underlying OS mechanisms.  If those
mechanisms are not already unified at the OS level, I have a
suspicion (been getting lots of those lately) that it is simply
impossible to do a "multi-wait", no matter how tricky the Python
code, or C code, or anything else, that one might do.

For example, if your OS doesn't use the same mechanism for
waiting for serial port input, file input, socket input,
keyboard or other user input, or timing input, then at least
one of those will not play nicely with a multi-wait mechanism.

-Peter



More information about the Python-list mailing list