taskthread provides a thread implementation that executes a repetitive task several times without the need to start up a new thread.
taskthread can be installed with pip, via pip install taskthread.
A thread object that repeats a task.
from taskthread import TaskThread import time def my_task(*args, **kwargs): print args, kwargs task_thread = TaskThread(my_task) task_thread.start() for i in xrange(10): task_thread.run_task() task_thread.join_task() task_thread.join()
Threads marked as daemon will be terminated.
Wait for the task to finish
Wait for the currently running task to complete.
|Parameters:||time_out – An int. The amount of time to wait for the task to finish.|
Called by threading.Thread, this runs in the new thread.
Run an instance of the task.