diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-21 14:43:06 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-31 17:05:17 +0000 |
commit | 6a6a5c01f768f2af581f1f764a3a1c40864459e7 (patch) | |
tree | fa23ecd0e0935fd3f62f455770e28b476858854b /bitbake/lib/bb/tests | |
parent | c4ecfc4dc5511a23e12ed68eb140a67fd4181127 (diff) | |
download | poky-6a6a5c01f768f2af581f1f764a3a1c40864459e7.tar.gz |
bitbake: event: Always use threadlock
With the move to a server idle thread, we always need threading. The
existing accessor functions could end up turning this off!
I was going to hold the lock whilst changing it, check if the value
was already set, cache the result and also fix the event code to always
release the lock with a try/finally.
Instead, disable the existing functions and use a with: block
to handle the lock, keeping things much simpler.
(Bitbake rev: 645c9d3b50e55f69b222cc338373cdfd91d524ce)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/event.py | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/bitbake/lib/bb/tests/event.py b/bitbake/lib/bb/tests/event.py index 4de4cced5e..d959f2d95d 100644 --- a/bitbake/lib/bb/tests/event.py +++ b/bitbake/lib/bb/tests/event.py | |||
@@ -451,10 +451,9 @@ class EventHandlingTest(unittest.TestCase): | |||
451 | and disable threadlocks tests """ | 451 | and disable threadlocks tests """ |
452 | bb.event.fire(bb.event.OperationStarted(), None) | 452 | bb.event.fire(bb.event.OperationStarted(), None) |
453 | 453 | ||
454 | def test_enable_threadlock(self): | 454 | def test_event_threadlock(self): |
455 | """ Test enable_threadlock method """ | 455 | """ Test enable_threadlock method """ |
456 | self._set_threadlock_test_mockups() | 456 | self._set_threadlock_test_mockups() |
457 | bb.event.enable_threadlock() | ||
458 | self._set_and_run_threadlock_test_workers() | 457 | self._set_and_run_threadlock_test_workers() |
459 | # Calls to UI handlers should be in order as all the registered | 458 | # Calls to UI handlers should be in order as all the registered |
460 | # handlers for the event coming from the first worker should be | 459 | # handlers for the event coming from the first worker should be |
@@ -462,20 +461,6 @@ class EventHandlingTest(unittest.TestCase): | |||
462 | self.assertEqual(self._threadlock_test_calls, | 461 | self.assertEqual(self._threadlock_test_calls, |
463 | ["w1_ui1", "w1_ui2", "w2_ui1", "w2_ui2"]) | 462 | ["w1_ui1", "w1_ui2", "w2_ui1", "w2_ui2"]) |
464 | 463 | ||
465 | |||
466 | def test_disable_threadlock(self): | ||
467 | """ Test disable_threadlock method """ | ||
468 | self._set_threadlock_test_mockups() | ||
469 | bb.event.disable_threadlock() | ||
470 | self._set_and_run_threadlock_test_workers() | ||
471 | # Calls to UI handlers should be intertwined together. Thanks to the | ||
472 | # delay in the registered handlers for the event coming from the first | ||
473 | # worker, the event coming from the second worker starts being | ||
474 | # processed before finishing handling the first worker event. | ||
475 | self.assertEqual(self._threadlock_test_calls, | ||
476 | ["w1_ui1", "w2_ui1", "w1_ui2", "w2_ui2"]) | ||
477 | |||
478 | |||
479 | class EventClassesTest(unittest.TestCase): | 464 | class EventClassesTest(unittest.TestCase): |
480 | """ Event classes test class """ | 465 | """ Event classes test class """ |
481 | 466 | ||