[Twisted-Python] twisted and threading

Christopher Armstrong radeex at gmail.com
Tue Aug 17 18:49:25 MDT 2004

On Tue, 17 Aug 2004 20:34:44 -0400, twisted-10152003 at atlas.lcs.mit.edu
<twisted-10152003 at atlas.lcs.mit.edu> wrote:
> I wrapped a c library using swig and was hoping to make use of it in
> a twisted server I am writing.  The issue is that the c library
> fundamentally blocks waiting for input that may never come.  Is
> there a way from twisted to deal with this cleanly within the framework?
> I.e. some combination of adding a reactor.addSystemEventTrigger event
> and calling reactor.threadpool.stop seem like it should work but
> I haven't had any luck yet.

Geeze, where'd you come up with that stuff? Accessing
reactor.threadpool directly is Really Bad. I hope there's no example
code or documentation that refers to that.

Try twisted.internet.threads.deferToThread(myBlockingCall) --> Deferred.

 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+            http://radix.twistedmatrix.com

More information about the Twisted-Python mailing list