summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/event.py21
-rw-r--r--bitbake/lib/toaster/tests/functional/README0
2 files changed, 21 insertions, 0 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 42745e241e..65b7ebb43b 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -29,6 +29,8 @@ import logging
29import atexit 29import atexit
30import traceback 30import traceback
31import ast 31import ast
32import threading
33
32import bb.utils 34import bb.utils
33import bb.compat 35import bb.compat
34import bb.exceptions 36import bb.exceptions
@@ -68,12 +70,22 @@ _event_handler_map = {}
68_catchall_handlers = {} 70_catchall_handlers = {}
69_eventfilter = None 71_eventfilter = None
70_uiready = False 72_uiready = False
73_thread_lock = threading.Lock()
74_thread_lock_enabled = False
71 75
72if hasattr(__builtins__, '__setitem__'): 76if hasattr(__builtins__, '__setitem__'):
73 builtins = __builtins__ 77 builtins = __builtins__
74else: 78else:
75 builtins = __builtins__.__dict__ 79 builtins = __builtins__.__dict__
76 80
81def enable_threadlock():
82 global _thread_lock_enabled
83 _thread_lock_enabled = True
84
85def disable_threadlock():
86 global _thread_lock_enabled
87 _thread_lock_enabled = False
88
77def execute_handler(name, handler, event, d): 89def execute_handler(name, handler, event, d):
78 event.data = d 90 event.data = d
79 addedd = False 91 addedd = False
@@ -146,11 +158,17 @@ def print_ui_queue():
146 logger.handle(event) 158 logger.handle(event)
147 159
148def fire_ui_handlers(event, d): 160def fire_ui_handlers(event, d):
161 global _thread_lock
162 global _thread_lock_enabled
163
149 if not _uiready: 164 if not _uiready:
150 # No UI handlers registered yet, queue up the messages 165 # No UI handlers registered yet, queue up the messages
151 ui_queue.append(event) 166 ui_queue.append(event)
152 return 167 return
153 168
169 if _thread_lock_enabled:
170 _thread_lock.acquire()
171
154 errors = [] 172 errors = []
155 for h in _ui_handlers: 173 for h in _ui_handlers:
156 #print "Sending event %s" % event 174 #print "Sending event %s" % event
@@ -169,6 +187,9 @@ def fire_ui_handlers(event, d):
169 for h in errors: 187 for h in errors:
170 del _ui_handlers[h] 188 del _ui_handlers[h]
171 189
190 if _thread_lock_enabled:
191 _thread_lock.release()
192
172def fire(event, d): 193def fire(event, d):
173 """Fire off an Event""" 194 """Fire off an Event"""
174 195
diff --git a/bitbake/lib/toaster/tests/functional/README b/bitbake/lib/toaster/tests/functional/README
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/tests/functional/README