[Twisted-Python] callLater

Eduardo Matus ematus at gmail.com
Thu Jan 17 14:54:54 MST 2008


hey.. the code is to.... dirty.. but look this...

reactor.callLater(3,f)

for x in range(100000000000000): # for example... a big time-consumption
       #do something
reactor.callLater(3,g)

the 'g' method will not start at the same time of 'f'


the python sched module, in this same example is like this

s = sched..... bla..bla..

s.enter(3,1,f,())
for x in range(100000000000000): # for example... a big time-consumption
       #do something
s.enter(3,1,g,())

s.run()

in this case... 'f' and 'g' will be called at the "same" time..

thks.


On Jan 17, 2008 6:33 PM, Christopher Armstrong <radix at twistedmatrix.com>
wrote:

> On Jan 17, 2008 4:09 PM, Eduardo Matus <ematus at gmail.com> wrote:
> > hey all....
> >
> > is there a way to add tasks  and then run the timer in callLater from
> the
> > reactor class??
> > like sched module in python...
> >
> > because if I want to call 2 different functions at the "same" time..
> >
> > reactor.callLater(3,f)
> > reactor.callLater(3,g)
> >
> > the 'g' function will be called 'n' seconds after the 'f' method....
>
> No it won't. They'll both be called at (almost) the same time. If
> you're actually seeing g being called 3 seconds after f, there's
> probably something else wrong in your application. Please post a
> minimal complete example showing your problem.
>
> --
> Christopher Armstrong
> International Man of Twistery
> http://radix.twistedmatrix.com/
> http://twistedmatrix.com/
> http://canonical.com/
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20080117/8a29a50b/attachment.html>


More information about the Twisted-Python mailing list