[Twisted-Python] twisted on os x: cfreactor or kqreactor?

Bob Ippolito bob at redivi.com
Sat Apr 24 20:23:34 MDT 2004


On Apr 23, 2004, at 12:23 PM, rayg wrote:

> i just created a fink package for PyKQeue
> (http://sourceforge.net/tracker/index.php? 
> func=detail&aid=940552&group_id=17203&atid=414256)
> and this now allows me to use kqreactor.
>
> if i'm not not planning on using any cocoa functionality, is there any
> advantage to use cfreactor over kqreactor on os x?
>
> i wasn't able to find any direct comparison between the mechanisms  
> behind
> kqreactor and cfreactor, but i did see that NSRunLoop is asynchronous,
> like kqueue.  i've tested both reactors on a simple script and noticed
> cfreactor doesn't stop() 75% of the time, so i'm inclined to just use
> kqreactor, instead of tracking down why cfreactor isn't behaving...

You need to use cfreactor or else twisted will block.  You basically  
have no choice.

If that script has a problem with SVN trunk of Twisted, then post the  
script as a bug and I will fix it.  That said, stop() isn't necessarily  
going to cause the program to exit (it doesn't call CFRunLoopStop), but  
it should shut down twisted.  I've only extensively tested it when used  
with a NSRunLoop with Cocoa stuff going on, and never bothered with  
stop functionality because NSRunLoop doesn't have a stop method at all  
(exiting is done via -[NSApplication terminate] or an exit call).

-bob





More information about the Twisted-Python mailing list