From 6c66f7e4848a076f553c81bdb64dd85610af2d79 Mon Sep 17 00:00:00 2001 From: aleherbau Date: Tue, 31 May 2011 13:20:47 +0000 Subject: TCF Python: Start discovery on demand only --- python/src/tcf/EventQueue.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'python/src/tcf/EventQueue.py') diff --git a/python/src/tcf/EventQueue.py b/python/src/tcf/EventQueue.py index c3084dde2..0efc5f60c 100644 --- a/python/src/tcf/EventQueue.py +++ b/python/src/tcf/EventQueue.py @@ -14,11 +14,12 @@ import protocol class EventQueue(object): - def __init__(self): + def __init__(self, on_shutdown=None): self.__thread = threading.Thread(target=self, name="TCF Event Dispatcher") self.__thread.daemon = True self.__is_waiting = False self.__is_shutdown = False + self.__on_shutdown = on_shutdown self.__lock = threading.Condition() self.__queue = [] @@ -27,6 +28,8 @@ class EventQueue(object): def shutdown(self): try: + if self.__on_shutdown: + self.__on_shutdown() with self.__lock: self.__is_shutdown = True if self.__is_waiting: -- cgit v1.2.3