subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1387975 - /subversion/trunk/subversion/tests/cmdline/svntest/main.py
Date Thu, 20 Sep 2012 11:13:35 GMT
Author: stsp
Date: Thu Sep 20 11:13:35 2012
New Revision: 1387975

URL: http://svn.apache.org/viewvc?rev=1387975&view=rev
Log:
* subversion/tests/cmdline/svntest/main.py
   (TestSpawningThread): Wrap invocation of the progress callback with a mutex.
    Leaves the actual running of tests as the only multi-threaded code path.
    Might fix problems with overlong progress bars when running tests in
    parallel (which were so far only observed on Windows, but I've also
    seen the problem happen on OpenBSD just now).

Modified:
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1387975&r1=1387974&r2=1387975&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Thu Sep 20 11:13:35 2012
@@ -1232,7 +1232,7 @@ class TestSpawningThread(threading.Threa
   def __init__(self, queue, progress_func, tests_total):
     threading.Thread.__init__(self)
     self.queue = queue
-    self.queue_lock = threading.Lock()
+    self.lock = threading.Lock()
     self.results = []
     self.progress_func = progress_func
     self.tests_total = tests_total
@@ -1240,21 +1240,21 @@ class TestSpawningThread(threading.Threa
   def run(self):
     while True:
       try:
-        self.queue_lock.acquire()
+        self.lock.acquire()
         next_index = self.queue.get_nowait()
       except queue.Empty:
         return
       finally:
-        self.queue_lock.release()
+        self.lock.release()
 
       self.run_one(next_index)
 
       # signal progress
       if self.progress_func:
-        self.queue_lock.acquire()
-        qsize = self.queue.qsize() 
-        self.queue_lock.release()
-        self.progress_func(self.tests_total - qsize, self.tests_total)
+        self.lock.acquire()
+        self.progress_func(self.tests_total - self.queue.qsize(),
+                           self.tests_total)
+        self.lock.release()
 
   def run_one(self, index):
     command = os.path.abspath(sys.argv[0])



Mime
View raw message