[Twisted-Python] twisted and threading
radeex at gmail.com
Tue Aug 17 20:30:04 MDT 2004
On Tue, 17 Aug 2004 22:18:51 -0400, twisted-10152003 at atlas.lcs.mit.edu
<twisted-10152003 at atlas.lcs.mit.edu> wrote:
> Christopher Armstrong [radeex at gmail.com] wrote:
> >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.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.
> >Try twisted.internet.threads.deferToThread(myBlockingCall) -->
> Ah, but that doesn't work. As I stated the c library (not mine) calls
> potentially block forever (or at least longer than I want to wait to
> shutdown the twisted server). The thread created by deferTothread may
> never complete which makes shutting down the server gracefully
> impossible (or so I thought?).
So you want to be able to murder that thread while you're shutting
down? I don't the solution to that, but I just want to be clear.
Indeed, maybe something involving a shutdown event.. I don't know.
> >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.
> The threadpool and a link to its interface are mentioned on the primary
> threading howto. No mention of "Really Bad" there.
Ahh. That doesn't mention anything about reactor.threadpool, though,
which is the evil thing to touch.
Twisted | Christopher Armstrong: International Man of Twistery
Radix | Release Manager, Twisted Project
More information about the Twisted-Python