[Twisted-Python] twisted on os x: cfreactor or kqreactor?
![](https://secure.gravatar.com/avatar/93a82e5d891edc597f21392f09dff7c3.jpg?s=120&d=mm&r=g)
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...
![](https://secure.gravatar.com/avatar/b932b1e5a3e8299878e579f51f49b84a.jpg?s=120&d=mm&r=g)
On Apr 23, 2004, at 12:23 PM, rayg wrote:
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
![](https://secure.gravatar.com/avatar/b932b1e5a3e8299878e579f51f49b84a.jpg?s=120&d=mm&r=g)
On Apr 24, 2004, at 10:23 PM, Bob Ippolito wrote:
I'm sorry, I read your message incorrectly. If you are not using Cocoa functionality, use the default reactor or kqreactor (which will only work on 10.3). CFRunLoop is designed to support Carbon (probably) and Cocoa applications. There is no good reason to use it for a POSIX app unless you are using other event driven CoreFoundation code (highly unlikely, in Python anyway). The way CoreFoundation does async socket I/O is to have a single network thread that posts events to the run loop thread. In 10.2 and earlier it used select(). I am not sure if it is using kqueue or not in 10.3 (nor should I have to care). -bob
![](https://secure.gravatar.com/avatar/3a7e70f3ef2ad1539da42afc85c8d09d.jpg?s=120&d=mm&r=g)
rayg wrote:
i just created a fink package for PyKQeue ...
Ahem. Pardon this repost, it was a moderator error. -- Twisted | Christopher Armstrong: International Man of Twistery Radix | Release Manager, Twisted Project ---------+ http://radix.twistedmatrix.com/
![](https://secure.gravatar.com/avatar/b932b1e5a3e8299878e579f51f49b84a.jpg?s=120&d=mm&r=g)
On Apr 23, 2004, at 12:23 PM, rayg wrote:
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
![](https://secure.gravatar.com/avatar/b932b1e5a3e8299878e579f51f49b84a.jpg?s=120&d=mm&r=g)
On Apr 24, 2004, at 10:23 PM, Bob Ippolito wrote:
I'm sorry, I read your message incorrectly. If you are not using Cocoa functionality, use the default reactor or kqreactor (which will only work on 10.3). CFRunLoop is designed to support Carbon (probably) and Cocoa applications. There is no good reason to use it for a POSIX app unless you are using other event driven CoreFoundation code (highly unlikely, in Python anyway). The way CoreFoundation does async socket I/O is to have a single network thread that posts events to the run loop thread. In 10.2 and earlier it used select(). I am not sure if it is using kqueue or not in 10.3 (nor should I have to care). -bob
![](https://secure.gravatar.com/avatar/3a7e70f3ef2ad1539da42afc85c8d09d.jpg?s=120&d=mm&r=g)
rayg wrote:
i just created a fink package for PyKQeue ...
Ahem. Pardon this repost, it was a moderator error. -- Twisted | Christopher Armstrong: International Man of Twistery Radix | Release Manager, Twisted Project ---------+ http://radix.twistedmatrix.com/
participants (3)
-
Bob Ippolito
-
Christopher Armstrong
-
rayg