summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-17 21:17:31 -0700
committerPixel <pixel@nobis-crew.org>2011-10-17 21:17:31 -0700
commitbc4f9afa3e19fc7f7b9fd642bf6bf170b319f5f7 (patch)
treeae5e530743accc91fa87cc351b2108fbc47aaebb /includes
parent1e0ba312edbe0feea88737380ef1a71782779437 (diff)
Removing the 'non-preemptible' madness before it could even be used.
Diffstat (limited to 'includes')
-rw-r--r--includes/Task.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/includes/Task.h b/includes/Task.h
index 691d47f..64156ba 100644
--- a/includes/Task.h
+++ b/includes/Task.h
@@ -90,23 +90,29 @@ class Task {
virtual const char * getName() = 0;
Status getStatus() { return m_status; }
static Task * getCurrentTask();
+ static void prepare(Events::BaseEvent * evt) {
+ Task * t = getCurrentTask();
+ t->waitFor(evt);
+ }
static void yield(Events::BaseEvent * evt, bool interruptible = false) throw (GeneralException) {
Task * t = getCurrentTask();
- t->waitFor(evt, true);
+ t->waitFor(evt);
do {
- t->yield(true);
+ t->yield();
+ Printer::elog(E_TASK, "operation back from yielding; interruptible = %s; okayToEAgain = %s", interruptible ? "true" : "false", t->m_okayToEAgain ? "true" : "false");
} while ((!interruptible || !t->m_okayToEAgain) && !evt->gotSignal());
- if (interruptible && t->m_okayToEAgain && !evt->gotSignal())
+ if (interruptible && t->m_okayToEAgain && !evt->gotSignal()) {
+ Printer::elog(E_TASK, "operation is throwing an exception.");
throw EAgain(evt);
+ }
}
TaskMan * getTaskMan() { return m_taskMan; }
struct ev_loop * getLoop();
protected:
- void yield(bool override = false);
+ void yield();
virtual void Do() = 0;
- void waitFor(Events::BaseEvent * event, bool override = false);
- bool setPreemptible(bool enable);
+ void waitFor(Events::BaseEvent * event);
bool setOkayToEAgain(bool enable) {
bool oldValue = m_okayToEAgain;
m_okayToEAgain = enable;
@@ -125,7 +131,6 @@ class Task {
friend class Events::TaskEvent;
typedef std::vector<Events::TaskEvent *> waitedByList_t;
waitedByList_t m_waitedBy;
- struct ev_loop * m_loop;
bool m_okayToEAgain;
};