mirror of
https://github.com/python/cpython.git
synced 2025-10-19 16:03:42 +00:00
gh-87135: test_threading: Wait on thread, not an Event it sets (GH-133198)
When the event is set the thread might not be done yet.
This is a fix-up for commit 4ebbfcf30e
This commit is contained in:
parent
5154d412a4
commit
8b26b23a96
1 changed files with 4 additions and 4 deletions
|
@ -1219,18 +1219,18 @@ def test_join_finished_daemon_thread_in_finalization(self):
|
|||
import threading
|
||||
done = threading.Event()
|
||||
|
||||
def loop():
|
||||
def set_event():
|
||||
done.set()
|
||||
|
||||
|
||||
class Cycle:
|
||||
def __init__(self):
|
||||
self.self_ref = self
|
||||
self.thr = threading.Thread(target=loop, daemon=True)
|
||||
self.thr = threading.Thread(target=set_event, daemon=True)
|
||||
self.thr.start()
|
||||
done.wait()
|
||||
self.thr.join()
|
||||
|
||||
def __del__(self):
|
||||
assert done.is_set()
|
||||
assert not self.thr.is_alive()
|
||||
self.thr.join()
|
||||
assert not self.thr.is_alive()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue