summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/AsynchronousTask.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-03-16 22:36:33 -0700
committerZac Medico <zmedico@gentoo.org>2011-03-18 12:49:35 -0700
commit5c1e74b2d9a68eb97557c76859bcdc74675d03d7 (patch)
tree836a6f272d7f43d64a375efc7bc889a0b7852f68 /pym/_emerge/AsynchronousTask.py
parent2b4d81caa05f5cb5aaf231ca25573c5547583c38 (diff)
downloadportage-5c1e74b2d9a68eb97557c76859bcdc74675d03d7.tar.gz
portage-5c1e74b2d9a68eb97557c76859bcdc74675d03d7.tar.bz2
portage-5c1e74b2d9a68eb97557c76859bcdc74675d03d7.zip
AsynchronousTask: add _cancel template method
Diffstat (limited to 'pym/_emerge/AsynchronousTask.py')
-rw-r--r--pym/_emerge/AsynchronousTask.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/pym/_emerge/AsynchronousTask.py b/pym/_emerge/AsynchronousTask.py
index 1918b839b..de0080042 100644
--- a/pym/_emerge/AsynchronousTask.py
+++ b/pym/_emerge/AsynchronousTask.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.SlotObject import SlotObject
@@ -45,8 +45,17 @@ class AsynchronousTask(SlotObject):
return self.returncode
def cancel(self):
- self.cancelled = True
- self.wait()
+ if not self.cancelled:
+ self.cancelled = True
+ self._cancel()
+ self.wait()
+
+ def _cancel(self):
+ """
+ Subclasses should implement this, as a template method
+ to be called by AsynchronousTask.cancel().
+ """
+ pass
def addStartListener(self, f):
"""