[Twisted-Python] Running twisted app in a different thread
Hi all, I am new to Twisted, please be gentle :) The Twisted application I am dealing with is python-vnc-viewer (http://python-vnc.viewer.googlecode.com). We are attempting the RFB library implemented using Twisted in our application, to bring up a customer viewer. Our uses a threading model that is quite centric to our application. Is it possible to ask the Twisted application to run in a sea prate thread? Thanks. -- "The secret impresses no-one, the trick you use it for is everything" - Alfred Borden (The Prestiege)
Hi Devraj,
Is it possible to ask the Twisted application to run in a sea prate thread?
Yes it is possible. Simply start the reactor in a thread, but run it as: reactor.run(installSignalHandlers=False) If you do it this way you're going to have to handle signals yourself. You're going to have to be very careful about calling code in the Twisted thread from other threads as Twisted isn't threadsafe. To do this properly take a look at reactor.callFromThread. Cheers, Reza -- Reza Lotun mobile: +44 (0)7521 310 763 email: rlotun@gmail.com work: reza@tweetdeck.com twitter: @rlotun
participants (3)
-
Devraj Mukherjee
-
Reza Lotun
-
ssteinerX@gmail.com