summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Noble <pixel@nobis-crew.org>2013-08-01 17:29:46 -0700
committerNicolas Noble <pixel@nobis-crew.org>2013-08-01 17:29:46 -0700
commit20b8ddc82b3c7b725993b2053acb35676801ce8b (patch)
tree12127215a1cc0389f3be8e00981b5fb8aa1aab9d
parent95ea7b338aa5d48994ba96571811c25e9d44e41a (diff)
Slightly more robust yield() call.
-rw-r--r--includes/Task.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/includes/Task.h b/includes/Task.h
index 27cb0bc..26d2c65 100644
--- a/includes/Task.h
+++ b/includes/Task.h
@@ -167,9 +167,7 @@ class Task {
struct ev_loop * getLoop();
bool isStackless() { return m_stackless; }
protected:
- void yield(Events::BaseEvent * evt = NULL) throw (GeneralException) {
- if (evt)
- waitFor(evt);
+ void yield() throw (GeneralException) {
if (yield(false))
throw EAgain(NULL);
}
@@ -191,6 +189,11 @@ class Task {
m_okayToEAgain = true;
}
private:
+ void yield(Events::BaseEvent * evt) throw (GeneralException) {
+ waitFor(evt);
+ if (yield(false))
+ throw EAgain(NULL);
+ }
bool yield(bool stillRunning);
static size_t stackSize() { return 64 * 1024; }
void setup(TaskMan * taskMan, void * stack);