hgext/progress.py
changeset 23908 5502bd79d052
parent 23907 63c7783a5928
child 25186 80c5b2666a96
--- a/hgext/progress.py	Sat Jan 17 13:10:37 2015 -0800
+++ b/hgext/progress.py	Sat Jan 17 13:13:16 2015 -0800
@@ -37,6 +37,7 @@
 
 import sys
 import time
+import threading
 
 from mercurial.i18n import _
 testedwith = 'internal'
@@ -90,6 +91,7 @@
 class progbar(object):
     def __init__(self, ui):
         self.ui = ui
+        self._refreshlock = threading.Lock()
         self.resetstate()
 
     def resetstate(self):
@@ -241,6 +243,7 @@
 
     def progress(self, topic, pos, item='', unit='', total=None):
         now = time.time()
+        self._refreshlock.acquire()
         try:
             if pos is None:
                 self.starttimes.pop(topic, None)
@@ -273,7 +276,7 @@
                         self.lastprint = now
                         self.show(now, topic, *self.topicstates[topic])
         finally:
-            pass
+            self._refreshlock.release()
 
 _singleton = None