--- /home/haypo/prog/python/2.7/Lib/threading.py 2014-11-05 15:05:11.432003853 +0100 +++ /usr/lib64/python2.7/threading.py 2015-07-05 16:16:00.000000000 +0200 @@ -306,7 +306,7 @@ else: return True - def wait(self, timeout=None): + def wait(self, timeout=None, balancing=True): """Wait until notified or until a timeout occurs. If the calling thread has not acquired the lock when this method is @@ -355,7 +355,10 @@ remaining = endtime - _time() if remaining <= 0: break - delay = min(delay * 2, remaining, .05) + if balancing: + delay = min(delay * 2, remaining, 0.05) + else: + delay = remaining _sleep(delay) if not gotit: if __debug__: @@ -600,7 +603,7 @@ finally: self.__cond.release() - def wait(self, timeout=None): + def wait(self, timeout=None, balancing=True): """Block until the internal flag is true. If the internal flag is true on entry, return immediately. Otherwise, @@ -618,7 +621,7 @@ self.__cond.acquire() try: if not self.__flag: - self.__cond.wait(timeout) + self.__cond.wait(timeout, balancing) return self.__flag finally: self.__cond.release() @@ -908,7 +911,7 @@ if 'dummy_threading' not in _sys.modules: raise - def join(self, timeout=None): + def join(self, timeout=None, balancing=True): """Wait until the thread terminates. This blocks the calling thread until the thread whose join() method is @@ -957,7 +960,7 @@ if __debug__: self._note("%s.join(): timed out", self) break - self.__block.wait(delay) + self.__block.wait(delay, balancing) else: if __debug__: self._note("%s.join(): thread stopped", self) @@ -1143,7 +1146,7 @@ def _set_daemon(self): return True - def join(self, timeout=None): + def join(self, timeout=None, balancing=True): assert False, "cannot join a dummy thread"