[Stackless] The case for Twisted

Christopher Armstrong radix at twistedmatrix.com
Thu Aug 9 17:50:53 CEST 2007


I just want to make a quick note, in response to all the discussion of
asynchronous I/O on this list.

A lot of people seem to want to write their own event loop for doing
Stackless I/O. I think this is a waste of time. It's a *lot* of work
to get a robust and portable event loop.

Even if you hate the Twisted APIs above the core reactor, it's easy to
*just* use the Twisted reactor for doing event management and nothing
else. Let me point out the addReader and addWriter methods on the
reactor. They're the lowest-level mechanism for getting notifications
about file descriptors. All you need to do is implement an
IFileDescriptor with 'fileno', 'doRead', 'doWrite', and
'connectionLost' methods, and pass it to those two methods. This
FileDescriptor object can then do all the necessary stackless
integration.

There are also, of course, many opportunities for integration at a
higher level, like being able to "block" on Deferreds, or giving a
stackless API to the Twisted protocol system, and so forth. This is
great, but I understand some people may not want something so
high-level. Even if you don't, there's still much to be gained from
using the low-level reactor implementations.

-- 
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://stackless.com/cgi-bin/mailman/listinfo/stackless



More information about the Stackless mailing list