[Twisted-Python] reactor.stop stops entire twistd

Sergio Trejo serj_trejo at hotmail.com
Wed Jul 28 06:10:00 EDT 2004


I'm curious what would happen if two separate reactor callLater() methods 
were executed on two separate functions (we'll call them a() and b()) ... 
such that a() and b() would be scheduled to run at the same exact moment. 
How would Twisted handled such a situation? Is there such a thing as 
callLater() "collision" even if the probability of such collission is quite 
low?

Cheers,

Serg


>From: Matt Goodall <matt at pollenation.net>
>Reply-To: Twisted general discussion <twisted-python at twistedmatrix.com>
>To: Twisted discussion stuff <twisted-python at twistedmatrix.com>
>Subject: Re: [Twisted-Python] reactor.stop stops entire twistd
>Date: Wed, 28 Jul 2004 10:15:50 +0100
>
>On Wed, 2004-07-28 at 09:41, Tsai Li Ming wrote:
> > Hi,
> >
> > I have the following codes:
> >
> >
> > site = server.Site(Core())
> > application = service.Application('server')
> > sc = service.IServiceCollection(application)
> > q = internet.TCPServer(8081, site)
> > q.setServiceParent(sc)
> >
> > # twistd -y server.tac
> >
> > The core class uses methods that uses getProcessOutput, reactor.run aad
> > reactor.stop. However, the whole application gets shutdown because of
> > the reactor.stop.
> >
> > How do I avoid having my entire application getting stopped?
>
>Calling reactor.stop() is supposed to shutdown the application (see
>below) so please could you explain what you actually wanted to stop by
>calling reactor.stop().
>
>In the meantime, here's a couple of points to consider ...
>
>1. The reactor is the event loop for the process and, once running,
>*everything* happens because of an event. If you stop the reactor then
>you are explicitly telling the reactor to stop processing events and end
>the application.
>
>2. twistd manages the creation and activation of the reactor for you (as
>well as other useful stuff such as logging). You should not call
>reactor.run() in your application.
>
>Cheers, Matt
>
>--
>      __
>     /  \__     Matt Goodall, Pollenation Internet Ltd
>     \__/  \    w: http://www.pollenation.net
>   __/  \__/    e: matt at pollenation.net
>  /  \__/  \    t: +44 (0)113 2252500
>  \__/  \__/
>  /  \          Any views expressed are my own and do not necessarily
>  \__/          reflect the views of my employer.
>
>
>_______________________________________________
>Twisted-Python mailing list
>Twisted-Python at twistedmatrix.com
>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail





More information about the Twisted-Python mailing list