From 20b8ddc82b3c7b725993b2053acb35676801ce8b Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Thu, 1 Aug 2013 17:29:46 -0700 Subject: Slightly more robust yield() call. --- includes/Task.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'includes') 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); -- cgit v1.2.3