[Twisted-Python] Re: win 32 reactor
tdickenson at geminidataloggers.com
Tue Apr 1 03:08:31 EDT 2008
Jean-Paul Calderone wrote:
> Gabriel Rossetti wrote:
>>Is there a way to use
>>the supplied win32 reactors (there are three I think) or do I have to
>>write one myself? Could someone please point me in the right direction?
> The three reactors you're probably referring to are selectreactor,
> win32er, and IOCP reactor.
The problem on Windows is that there can only be one event loop running at
one time, but every library wants supply its own. This seem to be true for
the code Gabriel posted, and is certainly true of the reactors JP
mentioned, plus anything as ordinary as COM, the win32 MessageBox function,
or resizing a window!
This leads to a problem where your application will receive no twisted
events while your window is being resized, or a message box is visible.
IMO the best way to integrate twisted on win32 involves one of the threaded
reactors. This runs the select loop (or WFMO loop) in a separate thread,
then uses PostMessage to wake up your main thread for it to handle the
network events inside a message handler. For your application code this all
still looks like a single threaded model.
I hope this helps,
More information about the Twisted-Python