diff options
author | Nicolas Noble <pixel@nobis-crew.org> | 2013-08-01 16:02:21 -0700 |
---|---|---|
committer | Nicolas Noble <pixel@nobis-crew.org> | 2013-08-01 16:02:21 -0700 |
commit | 9d614195cff948d69df417add0b08b2fe44d4ec5 (patch) | |
tree | f239c653f6f3d2e1406f01f22f0789b5ef29434d /includes | |
parent | 4423441cc3f5f80b5e0f6d24dfe8b69828f67ab4 (diff) |
I'm surprised this worked so far. The yield / EAgain mechanism was pretty much broken when using stackless operations.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Task.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/includes/Task.h b/includes/Task.h index 3e1b9cf..27cb0bc 100644 --- a/includes/Task.h +++ b/includes/Task.h @@ -167,10 +167,11 @@ class Task { struct ev_loop * getLoop(); bool isStackless() { return m_stackless; } protected: - void yield(bool stillRunning = false) throw (GeneralException); - void yield(Events::BaseEvent * evt) { - waitFor(evt); - yield(); + void yield(Events::BaseEvent * evt = NULL) throw (GeneralException) { + if (evt) + waitFor(evt); + if (yield(false)) + throw EAgain(NULL); } virtual void Do() = 0; void waitFor(Events::BaseEvent * event); @@ -190,6 +191,7 @@ class Task { m_okayToEAgain = true; } private: + bool yield(bool stillRunning); static size_t stackSize() { return 64 * 1024; } void setup(TaskMan * taskMan, void * stack); static bool needsStacks(); |