diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-20 14:17:49 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-31 17:05:17 +0000 |
| commit | cb8efd4d20d7643632b04ce8350c1b58aed49122 (patch) | |
| tree | 6b8bbc5edf3e53fcb148b12a60861d7237356d9d /bitbake/lib/bb/event.py | |
| parent | 2c5bc0379675c11a84056b2ac5ccaad766c3e766 (diff) | |
| download | poky-cb8efd4d20d7643632b04ce8350c1b58aed49122.tar.gz | |
bitbake: event: Add enable/disable heartbeat code
Currently heartbeat events are always generated by the server whilst it is
active. Change this so they only appear when builds are running, which is
when most code would expect to be executed. This removes a number of races
around changes in the datastore which can happen outside of builds.
(Bitbake rev: 8c36c90afc392980d999a981a924dc7d22e2766e)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/event.py')
| -rw-r--r-- | bitbake/lib/bb/event.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 303b7a943f..db90724444 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
| @@ -69,6 +69,7 @@ _eventfilter = None | |||
| 69 | _uiready = False | 69 | _uiready = False |
| 70 | _thread_lock = threading.Lock() | 70 | _thread_lock = threading.Lock() |
| 71 | _thread_lock_enabled = False | 71 | _thread_lock_enabled = False |
| 72 | _heartbeat_enabled = False | ||
| 72 | 73 | ||
| 73 | def enable_threadlock(): | 74 | def enable_threadlock(): |
| 74 | global _thread_lock_enabled | 75 | global _thread_lock_enabled |
| @@ -78,6 +79,14 @@ def disable_threadlock(): | |||
| 78 | global _thread_lock_enabled | 79 | global _thread_lock_enabled |
| 79 | _thread_lock_enabled = False | 80 | _thread_lock_enabled = False |
| 80 | 81 | ||
| 82 | def enable_heartbeat(): | ||
| 83 | global _heartbeat_enabled | ||
| 84 | _heartbeat_enabled = True | ||
| 85 | |||
| 86 | def disable_heartbeat(): | ||
| 87 | global _heartbeat_enabled | ||
| 88 | _heartbeat_enabled = False | ||
| 89 | |||
| 81 | def execute_handler(name, handler, event, d): | 90 | def execute_handler(name, handler, event, d): |
| 82 | event.data = d | 91 | event.data = d |
| 83 | try: | 92 | try: |
