We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d1d912 commit e52abd2Copy full SHA for e52abd2
Lib/test/test_threading.py
@@ -1604,17 +1604,22 @@ def test_interrupt_main_invalid_signal(self):
1604
self.assertRaises(ValueError, _thread.interrupt_main, signal.NSIG)
1605
self.assertRaises(ValueError, _thread.interrupt_main, 1000000)
1606
1607
+ @threading_helper.reap_threads
1608
def test_can_interrupt_tight_loops(self):
1609
#Nothing to assert here. It just shouldn't hang.
1610
1611
cont = True
1612
+ started = False
1613
def worker():
1614
+ nonlocal started
1615
+ started = True
1616
while cont:
1617
pass
1618
1619
t = threading.Thread(target=worker)
1620
t.start()
- time.sleep(0.1)
1621
+ while not started:
1622
+ pass
1623
cont = False
1624
t.join()
1625
0 commit comments