diff options
Diffstat (limited to 'pym/_emerge/AsynchronousTask.py')
-rw-r--r-- | pym/_emerge/AsynchronousTask.py | 15 |
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): """ |