Re: [Pyobjc-dev] Re: FYI: Open Source Scripting Layer For Cocoa
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2003-06-13 13:42:16
|
Bob Ippolito wrote: > I've been meaning to develop a CFRunLoop reactor for Twisted for > months now. Basically, you would be replacing the select() mechanism > with something that used CFRunLoop, CFSocket (can probably use the > existing functionality and just have the CFSocket use the fileno from > them), and CFTimer. Unfortunately, not all of this stuff is wrapped > in PyObjC or Python 2.3 yet so I'm expecting it to entail a fair > amount of pain-in-the-ass C code with lots of structures and > callbacks into Python (yay CFSocket). I don't know anything about how twisted reactors work internally, but since Cocoa has pretty decent support for async I/O, wouldn't it be an option to use this instead of going all the way down to CFRunLoop? I'm thinking of these NSFileHandle methods: - acceptConnectionInBackgroundAndNotify - readInBackgroundAndNotify - readToEndOfFileInBackgroundAndNotify - waitForDataInBackgroundAndNotify and the notifications that go with them. Using any of the above will actually cause a thread to be spawned, but that's not visible from user code. I wonder though, does Cocoa spawn a new thread for each NSFileHandle, or will it use _one_ (possibly select-based) thread for all of them? Just |