-
Notifications
You must be signed in to change notification settings - Fork 0
decorators.thread
sikvelsigma edited this page Aug 18, 2022
·
7 revisions
- decorator
repeat_timer
Sets a separate thread that will call a function every set amount of seconds. Returns a Queue-like object that will let you retrieve accumulated results
from pyuseful.decorators.thread import repeat_timer
import time
@repeat_timer(timer=1, get_nones=False, get_false=False)
def fun(msg):
print(msg)
return 1
a = fun("hi")
time.sleep(2)
print(a.get())
time.sleep(2)
print(a.get())
a.stop()