[Twisted-Python] Accurate delays in callLater

Ian Duggan ian at ianduggan.net
Thu Jun 23 13:13:55 EDT 2005


The scheduling isn't preemptive. The main twisted thread would have to be 
passing through it's "find timed calls and run ones that are due" code within 
the window of time that you need.

Long calls in protocol code, or simply not being the currect process run by 
the processor would prevent it from scheduling your code in the time you 
need.

Think cooperative scheduling, not preemptive.

That being said, you might try adjusting the priority of the twisted process 
to give it more access to the CPU.

--Ian


On Thursday 23 June 2005 09:29, George Sakkis wrote:
> I'm using twisted for a realtime simulation and I'm calling
> reactor.callLater() for scheduling actions to be performed after a fixed
> short delay (~60msec). However, if there is a cpu-intensive procedure
> running in the meantime, the timer for the scheduled call may expire much
> later, an order of magnitude or more if the procedure takes too much time.
> Is this to be expected in general ? If not, does this may have to with the
> delay being too short or the cpu-intensive procedure being mainly run in
> an extension module ? Finally, is there a way to force the required delay
> (with a tolerance of a few msec) ?
>
> Thanks for any insight,
>
> George
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python




More information about the Twisted-Python mailing list