summaryrefslogtreecommitdiff
path: root/paste/webkit/FakeWebware/TaskKit/Task.py
diff options
context:
space:
mode:
authorIan Bicking <ian@ianbicking.org>2005-08-22 23:29:31 +0000
committerIan Bicking <ian@ianbicking.org>2005-08-22 23:29:31 +0000
commit82d331036f311709b77a1e3a90a9b191c9e49c61 (patch)
tree2c91bcd0181be8babe4146c3f448429e4840f29f /paste/webkit/FakeWebware/TaskKit/Task.py
parent36d1c63f5e12f1dfd6d5187359093a96a2fd2de4 (diff)
downloadpaste-git-82d331036f311709b77a1e3a90a9b191c9e49c61.tar.gz
Moved webkit to separate project
Diffstat (limited to 'paste/webkit/FakeWebware/TaskKit/Task.py')
-rw-r--r--paste/webkit/FakeWebware/TaskKit/Task.py59
1 files changed, 0 insertions, 59 deletions
diff --git a/paste/webkit/FakeWebware/TaskKit/Task.py b/paste/webkit/FakeWebware/TaskKit/Task.py
deleted file mode 100644
index 196dedb..0000000
--- a/paste/webkit/FakeWebware/TaskKit/Task.py
+++ /dev/null
@@ -1,59 +0,0 @@
-from MiscUtils import AbstractError
-
-
-class Task:
-
- def __init__(self):
- """ Subclasses should invoke super for this method. """
- # Nothing for now, but we might do something in the future.
- pass
-
- def run(self):
- """
- Override this method for you own tasks. Long running tasks can periodically
- use the proceed() method to check if a task should stop.
- """
- raise AbstractError, self.__class__
-
-
- ## Utility method ##
-
- def proceed(self):
- """
- Should this task continue running?
- Should be called periodically by long tasks to check if the system wants them to exit.
- Returns 1 if its OK to continue, 0 if its time to quit
- """
- return self._handle._isRunning
-
-
- ## Attributes ##
-
- def handle(self):
- """
- A task is scheduled by wrapping a handler around it. It knows
- everything about the scheduling (periodicity and the like).
- Under normal circumstances you should not need the handler,
- but if you want to write period modifying run() methods,
- it is useful to have access to the handler. Use it with care.
- """
- return self._handle
-
- def name(self):
- """
- Returns the unique name under which the task was scheduled.
- """
- return self._name
-
-
- ## Private method ##
-
- def _run(self, handle):
- """
- This is the actual run method for the Task thread. It is a private method which
- should not be overriden.
- """
- self._name = handle.name()
- self._handle = handle
- self.run()
- handle.notifyCompletion()