summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-15 11:52:54 -0800
committerPixel <pixel@nobis-crew.org>2011-11-15 11:52:54 -0800
commit5154e80b61bc5678cd1ce6018fd52b023c4b9079 (patch)
tree7bc42da42f8f19a843a5c9fc260ecc76aab0e72a
parent2ca2ef499eef0ebb1716857fc27121c0c4c3f2e3 (diff)
Moving the static yield from Task.h to Task.cc. You don't want to throw an exception from a .h file...
-rw-r--r--includes/Task.h14
-rw-r--r--src/Task.cc15
2 files changed, 16 insertions, 13 deletions
diff --git a/includes/Task.h b/includes/Task.h
index b124731..156add2 100644
--- a/includes/Task.h
+++ b/includes/Task.h
@@ -116,19 +116,7 @@ class Task {
Task * t = getCurrentTask();
t->waitFor(evt);
}
- static void yield(Events::BaseEvent * evt, bool interruptible = false) throw (GeneralException) {
- Task * t = getCurrentTask();
- t->waitFor(evt);
-
- do {
- 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()) {
- Printer::elog(E_TASK, "operation is throwing an exception.");
- throw EAgain(evt);
- }
- }
+ static void yield(Events::BaseEvent * evt, bool interruptible = false) throw (GeneralException);
TaskMan * getTaskMan() { return m_taskMan; }
struct ev_loop * getLoop();
protected:
diff --git a/src/Task.cc b/src/Task.cc
index ad481cc..3772dd5 100644
--- a/src/Task.cc
+++ b/src/Task.cc
@@ -149,3 +149,18 @@ void Balau::Events::Async::gotOwner(Task * task) {
void Balau::Events::Custom::gotOwner(Task * task) {
m_loop = task->getLoop();
}
+
+void Balau::Task::yield(Events::BaseEvent * evt, bool interruptible) throw (GeneralException) {
+ Task * t = getCurrentTask();
+ t->waitFor(evt);
+
+ do {
+ 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()) {
+ Printer::elog(E_TASK, "operation is throwing an exception.");
+ throw EAgain(evt);
+ }
+}