[Twisted-Python] Twisted communication with embedded C thread

Tom Cocagne tom.cocagne at gmail.com
Thu Jul 7 13:48:57 EDT 2005


   Greetings all,

    I was wondering if anyone has suggestions for a good way to go
about setting up a message-passing communication channel between one
or more C threads and a single thread dedicated to running
Python/Twisted. I already have functional Python bindings accessing
the contents of the messages (basically C structures) but need some
way to exchange the messages between the C threads and the Python
thread.

    All I really need is a means by which to inform Twisted's reactor
that a C thread has sent a message.  My original plan was to use a
pair of pipes (via os.pipe()) to send pointers back and forth but it
didn't seem to work on Windows . I'm pretty sure this will work fine
for posix systems but it definitely didn't work on my first attempt
with Windows (though the problem may have been due to my library
configuration).

    I would imagine that something along these lines has been done
before. Does anyone know of an existing approach or have suggestions
for a better solution?

    Extra Details:
      I'm using Python 2.4.1, Twisted 2.0, and GLib 2.6

    Cheers,

    Tom




More information about the Twisted-Python mailing list