summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Task.cc15
1 files changed, 15 insertions, 0 deletions
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);
+ }
+}