[Twisted-Python] CFReactor redux

Phil Christensen phil at bubblehouse.org
Wed Oct 24 08:03:54 EDT 2007


On Oct 24, 2007, at 5:26 AM, Ben Artin wrote:

>> It was suggested to me that one thing that was needed was a  
>> reactor based on ThreadedSelectReactor that would integrate with  
>> the Cocoa runtime.
>
> Didn't Bob Ippolito already do this? <http://bob.pythonmac.org/ 
> archives/2005/04/17/twisted-and-foreign-event-loops/>

Yeah, essentially, but it's complicated.

That post refers to TSR, which is almost, but not quite, a complete  
reactor. That's why it's been moved to _threadedselectreactor.py.

As I understand it, TSR is intended to be the foundation for any  
reactor that needs to integrate with a foreign event loop. The  
wxreactor is a TSR subclass that wraps up the wx-specific details  
into a convenience class.

cfreactor2 was meant to be like this, but it suffers from the same  
issue wxreactor does, in that the reactor cannot be stopped and  
restarted. Technically, reactors aren't supposed to support this, but  
Trial requires the functionality for testing.

-phil




More information about the Twisted-Python mailing list