From 226118cbaed9b2f092e2ae764260bf3b63951938 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 26 Oct 2013 22:16:08 +0200 Subject: [PATCH] oops, Waker needs locking --- waker.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) 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