asynchat sends data on async_chat.push and .push_with_producer

Jean-Paul Calderone exarkun at divmod.com
Wed May 14 06:20:05 EDT 2008


On Tue, 13 May 2008 18:20:29 -0700 (PDT), Giampaolo Rodola' <gnewsg at gmail.com> wrote:
>On 14 Mag, 02:56, Jean-Paul Calderone <exar... at divmod.com> wrote:
>
>> Why?  Isn't this why subtraction exists?  If there is a call scheduled to
>> happen at T1 and the current time is T2, then I know that after (T1 - T2)
>> elapses, it will be time to run the call.  Why do I have to do any checks
>> at all?  I just tell select() to wait that long.  Presumably this is just
>> what someone will do if they want to use asyncore with timed calls.  Call
>> asyncore.loop() in a loop, always passing (T1 - T2) as the timeout value.
>
>That doesn't work if I decide to schedule one or more calls AFTER the
>loop has started (see: "I already told select what timeout use").
>As far as I've understood by reading the Twisted core what happens is
>that there's a heap of scheduled calls and a loop that keeps calling
>time.time() to check the scheduled functions due to expire soonest.
>I've also proposed a patch for asyncore using the same approach:
>http://bugs.python.org/issue1641

This isn't how it works.  You're misreading the Twisted implementation.  I
don't know how to explain it any more clearly.

Jean-Paul



More information about the Python-list mailing list