On Jul 7, 2005, at 7:48 AM, Tom Cocagne wrote:
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?
Acquire the GIL, call reactor.callFromThread, release the GIL. -bob