diff options
Diffstat (limited to 'module/interaction/EventManager.py')
-rw-r--r-- | module/interaction/EventManager.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/module/interaction/EventManager.py b/module/interaction/EventManager.py index 38faa3c46..02ecb82fb 100644 --- a/module/interaction/EventManager.py +++ b/module/interaction/EventManager.py @@ -1,14 +1,17 @@ # -*- coding: utf-8 -*- +from threading import Lock from traceback import print_exc from time import time +from module.utils import lock + class EventManager: """ Handles all Event related task, also stores an Event queue for clients, so they can retrieve them later. **Known Events:** - Most hook methods exists as events. These are some additional known events. + Most addon methods exists as events. These are some additional known events. ===================== ================ =========================================================== Name Arguments Description @@ -38,6 +41,8 @@ class EventManager: self.clients = {} self.events = {"metaEvent": []} + self.lock = Lock() + def getEvents(self, uuid): """ Get accumulated events for uuid since last call, this also registeres new client """ if uuid not in self.clients: @@ -80,6 +85,10 @@ class EventManager: if self.core.debug: print_exc() + self.updateClients(event, args) + + @lock + def updateClients(self, event, args): # append to client event queue if event in self.CLIENT_EVENTS: for uuid, client in self.clients.items(): @@ -88,7 +97,6 @@ class EventManager: else: client.append(event, args) - def removeFromEvents(self, func): """ Removes func from all known events """ for name, events in self.events.iteritems(): |