@@ -1654,12 +1654,10 @@ def test_notify(self):
16541654 p = self .Process (target = self .f , args = (cond , sleeping , woken ))
16551655 p .daemon = True
16561656 p .start ()
1657- self .addCleanup (p .join )
16581657
1659- p = threading .Thread (target = self .f , args = (cond , sleeping , woken ))
1660- p .daemon = True
1661- p .start ()
1662- self .addCleanup (p .join )
1658+ t = threading .Thread (target = self .f , args = (cond , sleeping , woken ))
1659+ t .daemon = True
1660+ t .start ()
16631661
16641662 # wait for both children to start sleeping
16651663 sleeping .acquire ()
@@ -1686,7 +1684,9 @@ def test_notify(self):
16861684
16871685 # check state is not mucked up
16881686 self .check_invariant (cond )
1689- p .join ()
1687+
1688+ threading_helper .join_thread (t )
1689+ join_process (p )
16901690
16911691 def test_notify_all (self ):
16921692 cond = self .Condition ()
@@ -1763,16 +1763,17 @@ def test_notify_n(self):
17631763 woken = self .Semaphore (0 )
17641764
17651765 # start some threads/processes
1766+ workers = []
17661767 for i in range (3 ):
17671768 p = self .Process (target = self .f , args = (cond , sleeping , woken ))
17681769 p .daemon = True
17691770 p .start ()
1770- self . addCleanup ( p . join )
1771+ workers . append ( p )
17711772
17721773 t = threading .Thread (target = self .f , args = (cond , sleeping , woken ))
17731774 t .daemon = True
17741775 t .start ()
1775- self . addCleanup ( t . join )
1776+ workers . append ( t )
17761777
17771778 # wait for them to all sleep
17781779 for i in range (6 ):
@@ -1807,6 +1808,10 @@ def test_notify_n(self):
18071808 # check state is not mucked up
18081809 self .check_invariant (cond )
18091810
1811+ for w in workers :
1812+ # NOTE: join_process and join_thread are the same
1813+ threading_helper .join_thread (w )
1814+
18101815 def test_timeout (self ):
18111816 cond = self .Condition ()
18121817 wait = TimingWrapper (cond .wait )
0 commit comments