If you
use win32 objects, then just call WFMO yourself. (See
below.)
Of
course, you won't be able to wait on a python thread(ing)
object, unless there was a call like
Threading.GetOSObject()
or
something. (I wish there was such a call for threads, files, events,
etc.,
that
way you could write "mostly portable" code and use OS
specific
stuff
on the python objects if you wanted to.)
I
don't think there's a pure-python way to do the same
in one
call.
Why
not use a Queue.Queue object and just have all the threads post
results
there
- your consumer thread can wait on (.get) or poll (.get_nowait) on the
Queue
as
necessary.
mike
------------------------------
StopEvent = win32event.CreateEvent(None, 0, 0,
None)
rc =
win32event.MsgWaitForMultipleObjects(
(StopEvent,otherEvents...), 0, # wait all win32event.QS_ALLEVENTS, # type of input win32event.INFINITE) if rc == win32event.WAIT_OBJECT_0:
print "Got first event" break elif rc == win32event.WAIT_OBJECT_0+1: print "Got second event..." break elif rc == win32event.WAIT_TIMEOUT: else: raise RuntimeError, "unexpected win32wait return value"
|
- Threading question Matthew Sherborne
- Re: Threading question Trent Mick
- Re: Threading question David Ascher
- Re: Threading question Michael Robin
- Re: Threading question Matthew Sherborne
- Re: Threading question Syver Enstad