AsynchronousLock: implement _cancel
authorZac Medico <zmedico@gentoo.org>
Thu, 17 Mar 2011 20:08:35 +0000 (13:08 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 17 Mar 2011 20:08:35 +0000 (13:08 -0700)
pym/_emerge/AsynchronousLock.py

index 6e0a1ac2aa95ff4ecf51aa614130b1bd3cca9671..6fa2bf632d2ff8b40af853dc7409212e1fa4c649 100644 (file)
@@ -66,6 +66,10 @@ class AsynchronousLock(AsynchronousTask):
                if not self._waiting:
                        self.wait()
 
+       def _cancel(self):
+               if self._imp is not None:
+                       self._imp.cancel()
+
        def _wait(self):
                if self.returncode is not None:
                        return self.returncode
@@ -127,6 +131,10 @@ class _LockThread(AbstractPollTask):
                        self.returncode = os.EX_OK
                        self.wait()
 
+       def _cancel(self):
+               # There's currently no way to force thread termination.
+               pass
+
        def _wait(self):
                if self.returncode is not None:
                        return self.returncode