[Twisted-Python] Foreign event loop friendly reactor

Bob Ippolito bob at redivi.com
Sun Apr 17 05:42:28 EDT 2005


In response to the "wxpython issues" thread I had suggested that we 
should have a thread-using reactor that integrates with foreign event 
loops, so I wrote one and committed it 
(twisted.internet.threadedselectreactor).  Since this approach requires 
less maintenance, and whomever maintains the select reactor can 
trivially maintain this as well, I'm "officially" deprecating cfreactor 
(although I never really cared much to maintain it anyway).

An example of using it to integrate with a foreign event loop is at: 
doc/core/examples/Cocoa/SimpleWebClient

It should be relatively trivial to show how it could be used to 
integrate with other event loops (wx, Tkinter, pygame, etc.).  
Effectively, it's compatible with anything that has a thread-safe way 
to notify the main event loop.

In the future, it might make sense to revise the reactor API to support 
"interleave" directly, and change the existing reactors accordingly so 
that more than just select can support this behavior.

-bob





More information about the Twisted-Python mailing list