[Twisted-Python] Threading examples...
wcmclen at hotmail.com
Tue Mar 23 17:34:04 EST 2004
Hmmm... I tried something pretty close to that (though I have no callback
called writeRequestAndFinish() in my example and am not sure what it's
supposed to do)... but running the threads.deferToThread() routine still
leaves me with the problem that the thread doesn't die. I can't kill the
app without going and manually killing it via pid.
Is there anything that I can do so that when aSillyBlockingMethod() is
finished it just exits?
>From: stephan <mailinglists at shechen.at>
>Reply-To: twisted-python at twistedmatrix.com
>To: twisted-python at twistedmatrix.com
>Subject: Re: [Twisted-Python] Threading examples...
>Date: Tue, 23 Mar 2004 14:25:13 -0800
>The following snippet is the code I use and it works for my needs. Be
>careful with non-threadsafe code (db api, etc...) though.
>from twisted.internet import threads
> writeRequestAndFinish, request)
>I am using this in a twisted webserver that is why I am registering the
>writeRequestAndFinish methode to finish up on the render methode where I
>returned server.NOT_DONE_YET. But you can register any callback or no
>callback as well.
>On Tue, 23 Mar 2004 12:19:01 -0700, William McLendon <wcmclen at hotmail.com>
>>I'm trying out some of the threading examples from the web and am getting
>>some a lockup at the end.
>>Here's the code I'm playing with, I pulled it straight from the examples:
>>from twisted.internet import reactor
>> import time
>> print x
>># run method in thread
>>reactor.callInThread(aSillyBlockingMethod, "2 seconds have passed")
>>Is there something I need to do that will make the thread go away? Are
>>there some more examples of threading in Twisted-Python available?
Get rid of annoying pop-up ads with the new MSN Toolbar FREE!
More information about the Twisted-Python