[issue29569] threading.Timer class: Continue periodical execution till action returns True

slytomcat report at bugs.python.org
Wed Feb 15 09:54:10 EST 2017


New submission from slytomcat:

I think that functionality of threading.Timer class can be easily extended to generate the sequence of runs with specified period. The idea comes from the GLib.timeout_add function. 

Run method of threading.Timer should look like:

    def run(self):
        """Continue execution after wait till function returns True"""
        while(not self.finished.wait(self.interval)):
            if not self.function(*self.args, **self.kwargs):
                break
        self.finished.set()

----------
components: Library (Lib)
messages: 287858
nosy: slytomcat
priority: normal
severity: normal
status: open
title: threading.Timer class: Continue periodical execution till action returns True
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29569>
_______________________________________


More information about the Python-bugs-list mailing list