@@ -1654,12 +1654,10 @@ def test_notify(self):
1654
1654
p = self .Process (target = self .f , args = (cond , sleeping , woken ))
1655
1655
p .daemon = True
1656
1656
p .start ()
1657
- self .addCleanup (p .join )
1658
1657
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 ()
1663
1661
1664
1662
# wait for both children to start sleeping
1665
1663
sleeping .acquire ()
@@ -1686,7 +1684,9 @@ def test_notify(self):
1686
1684
1687
1685
# check state is not mucked up
1688
1686
self .check_invariant (cond )
1689
- p .join ()
1687
+
1688
+ threading_helper .join_thread (t )
1689
+ join_process (p )
1690
1690
1691
1691
def test_notify_all (self ):
1692
1692
cond = self .Condition ()
@@ -1763,16 +1763,17 @@ def test_notify_n(self):
1763
1763
woken = self .Semaphore (0 )
1764
1764
1765
1765
# start some threads/processes
1766
+ workers = []
1766
1767
for i in range (3 ):
1767
1768
p = self .Process (target = self .f , args = (cond , sleeping , woken ))
1768
1769
p .daemon = True
1769
1770
p .start ()
1770
- self . addCleanup ( p . join )
1771
+ workers . append ( p )
1771
1772
1772
1773
t = threading .Thread (target = self .f , args = (cond , sleeping , woken ))
1773
1774
t .daemon = True
1774
1775
t .start ()
1775
- self . addCleanup ( t . join )
1776
+ workers . append ( t )
1776
1777
1777
1778
# wait for them to all sleep
1778
1779
for i in range (6 ):
@@ -1807,6 +1808,10 @@ def test_notify_n(self):
1807
1808
# check state is not mucked up
1808
1809
self .check_invariant (cond )
1809
1810
1811
+ for w in workers :
1812
+ # NOTE: join_process and join_thread are the same
1813
+ threading_helper .join_thread (w )
1814
+
1810
1815
def test_timeout (self ):
1811
1816
cond = self .Condition ()
1812
1817
wait = TimingWrapper (cond .wait )
0 commit comments