Shutting down twisted reacotr

Operation Latte Thunder chris at angband.org
Thu Apr 28 08:34:33 EDT 2005


Jason  Mobarak <jason.mobarak at gmail.com> wrote:
> Why do you want to do this in a thread? What's wrong with
> reactor.callLater?
> 
> import time
> from twisted.internet import reactor
> 
> def shutdown():
> 
>    time.sleep(3)
>    print "stopping"
>    reactor.callFromThread(reactor.stop)
> 
> reactor.callInThread(shutdown)
> reactor.run()

In the app I am playing with, I have a thread that reads from the console.
When it terminates, I wanted it to shut down the reactor and couldn't use
callLater.  However, callFromThread worked perfectly.   I guess I need to
look at the docs some more to understand why its necessary 

-- 
chris at acheris.net			|             Roma Invicta!



More information about the Python-list mailing list