From: Ralf Jung Date: Sat, 26 Oct 2013 20:16:08 +0000 (+0200) Subject: oops, Waker needs locking X-Git-Url: https://git.ralfj.de/saartuer.git/commitdiff_plain/226118cbaed9b2f092e2ae764260bf3b63951938?ds=inline;hp=-c oops, Waker needs locking --- 226118cbaed9b2f092e2ae764260bf3b63951938 diff --git a/waker.py b/waker.py index 1cf2884..9c2cf06 100644 --- a/waker.py +++ b/waker.py @@ -1,5 +1,6 @@ from libtuer import ThreadRepeater from collections import namedtuple +from threading import Lock SLEEP_TIME = 0.5 @@ -10,26 +11,29 @@ class Waker(): self._sm = sm self._t = ThreadRepeater(self._wake, SLEEP_TIME, name="Waker") self._tobewokens = [] + self._tobewokens_lock = Lock() def register(f, time, one_shot = False): '''Register a function which is called approximately every