[Python-checkins] r75748 - in python/branches/release26-maint: Lib/test/test_thread.py

antoine.pitrou python-checkins at python.org
Tue Oct 27 13:32:19 CET 2009


Author: antoine.pitrou
Date: Tue Oct 27 13:32:18 2009
New Revision: 75748

Log:
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).
........


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Lib/test/test_thread.py

Modified: python/branches/release26-maint/Lib/test/test_thread.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_thread.py	(original)
+++ python/branches/release26-maint/Lib/test/test_thread.py	Tue Oct 27 13:32:18 2009
@@ -26,6 +26,7 @@
         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
 
@@ -37,6 +38,7 @@
             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):
@@ -47,7 +49,7 @@
         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):
@@ -89,6 +91,7 @@
             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()
 


More information about the Python-checkins mailing list