timers in threaded application

dieter dieter at handshake.de
Sat Jan 14 03:38:09 EST 2017


Skip Montanaro <skip.montanaro at gmail.com> writes:

> On Fri, Jan 13, 2017 at 3:23 AM, dieter <dieter at handshake.de> wrote:
>
>> If what you want to timeout are not I/O operations, you can have a
>> look at "threading.Timer". It uses a separate thread, lets it wait
>> a specified time and then starts a specified function, unless
>> "cancel"ed.
>>
>
> Ooh, hadn't considered that. That would seem to do the trick. I assume the
> function to be executed will be run in the timer's thread, so will have to
> suitably lock any shared data.

Yes.



More information about the Python-list mailing list