[PEAK] More event questions

Chad Rosenberg chad at idrankwhat.net
Thu Nov 11 18:26:07 EST 2004


So I changed around my earlier sample code to use a simple scheduler based
on reactor.callLater calls instead of using a generator and taskFactory.
Something like this:

    def start(self):
        self.reactor.callLater(0.1, self._run)

    def _run(self):
        self.callable(*self.args, **self.kwargs)
        self.reactor.callLater(self.period, self._run)

    ...

    def callable(self, *args, **kwargs):
        # do something
        self.eventLoop.runUntil(self.eventLoop.sleep(1), True)

Is it safe to use runUntil from a call originating from reactor.callLater?
I thought this would eliminate nested runUntils, but I am still getting
Unexpected reactor exits.  Any insights?

Thanks again,
Chad






More information about the PEAK mailing list