summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-10-23 18:35:18 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-10-23 18:35:18 (GMT)
commit1ff7f2c3a9e7d5ab252cd28d2bd651946ba8b2b8 (patch)
treeb6eb71a46771b3f1542a51192d3a2cdd85cd84be /Lib
parentf94af9f4644a651b720dd2ef0a0b3b9e94c15209 (diff)
downloadcpython-1ff7f2c3a9e7d5ab252cd28d2bd651946ba8b2b8.zip
cpython-1ff7f2c3a9e7d5ab252cd28d2bd651946ba8b2b8.tar.gz
cpython-1ff7f2c3a9e7d5ab252cd28d2bd651946ba8b2b8.tar.bz2
Merged revisions 75634 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r75634 | antoine.pitrou | 2009-10-23 20:34:17 +0200 (ven., 23 oct. 2009) | 9 lines Merged revisions 75633 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r75633 | antoine.pitrou | 2009-10-23 20:32:15 +0200 (ven., 23 oct. 2009) | 3 lines Issue #7194: test_thread could try to release an unacquired mutex (and fail). ........ ................
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_thread.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
index 84d5a9d..73d87b8 100644
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -24,6 +24,7 @@ class BasicThreadTest(unittest.TestCase):
self.done_mutex.acquire()
self.running_mutex = thread.allocate_lock()
self.random_mutex = thread.allocate_lock()
+ self.created = 0
self.running = 0
self.next_ident = 0
@@ -35,6 +36,7 @@ class ThreadRunningTests(BasicThreadTest):
self.next_ident += 1
verbose_print("creating task %s" % self.next_ident)
thread.start_new_thread(self.task, (self.next_ident,))
+ self.created += 1
self.running += 1
def task(self, ident):
@@ -45,7 +47,7 @@ class ThreadRunningTests(BasicThreadTest):
verbose_print("task %s done" % ident)
with self.running_mutex:
self.running -= 1
- if self.running == 0:
+ if self.created == NUMTASKS and self.running == 0:
self.done_mutex.release()
def test_starting_threads(self):
@@ -87,6 +89,7 @@ class ThreadRunningTests(BasicThreadTest):
for tss in (262144, 0x100000):
verbose_print("trying stack_size = (%d)" % tss)
self.next_ident = 0
+ self.created = 0
for i in range(NUMTASKS):
self.newtask()