AsynchronousLock: protect _wait() from recursion
authorZac Medico <zmedico@gentoo.org>
Fri, 22 Oct 2010 19:04:34 +0000 (12:04 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 24 Nov 2010 01:38:54 +0000 (17:38 -0800)
pym/_emerge/AsynchronousLock.py

index 3fe0e9747eaa524460d5900b3af6cc861f5fbebf..fe9d3621014e99688f247879b3131c40c740b08f 100644 (file)
@@ -27,7 +27,7 @@ class AsynchronousLock(AsynchronousTask):
 
        __slots__ = ('path', 'scheduler',) + \
                ('_imp', '_force_async', '_force_dummy', '_force_process', \
-               '_force_thread')
+               '_force_thread', '_waiting')
 
        def _start(self):
 
@@ -55,12 +55,15 @@ class AsynchronousLock(AsynchronousTask):
 
        def _imp_exit(self, imp):
                # call exit listeners
-               self.wait()
+               if not self._waiting:
+                       self.wait()
 
        def _wait(self):
                if self.returncode is not None:
                        return self.returncode
-               self.returncode = self._imp._wait()
+               self._waiting = True
+               self.returncode = self._imp.wait()
+               self._waiting = False
                return self.returncode
 
        def unlock(self):