aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/event.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-07 15:41:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-07 15:48:30 +0100
commitcb241fb8544dfb05646dbae1a1b04e17878a466c (patch)
treee462bcf4a90c775591d0aebbc321aaac7377760c /lib/bb/event.py
parent412bfab8721ea317898a1974f6a7a0d0bea763df (diff)
downloadbitbake-cb241fb8544dfb05646dbae1a1b04e17878a466c.tar.gz
event: Queue offline events for the UI
Messages printed when no UI is connected (e.g. memres) are currently lost. Use the existing queue mechanism to queue these until a UI attaches, then replay them. This isn't ideal but better than the current situation of losing them entirely. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/event.py')
-rw-r--r--lib/bb/event.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py
index 1462382f1..d5c5ef354 100644
--- a/lib/bb/event.py
+++ b/lib/bb/event.py
@@ -212,6 +212,12 @@ def fire(event, d):
if worker_fire:
worker_fire(event, d)
else:
+ # If messages have been queued up, clear the queue
+ global _uiready, ui_queue
+ if _uiready and ui_queue:
+ for queue_event in ui_queue:
+ fire_ui_handlers(queue_event, d)
+ ui_queue = []
fire_ui_handlers(event, d)
def fire_from_worker(event, d):
@@ -291,7 +297,10 @@ def register_UIHhandler(handler, mainui=False):
_ui_logfilters[_ui_handler_seq] = UIEventFilter(level, debug_domains)
return _ui_handler_seq
-def unregister_UIHhandler(handlerNum):
+def unregister_UIHhandler(handlerNum, mainui=False):
+ if mainui:
+ global _uiready
+ _uiready = False
if handlerNum in _ui_handlers:
del _ui_handlers[handlerNum]
return