From cc78db0520ff384892cbee69557a38c3a1b04613 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 8 Apr 2012 22:03:50 -0700 Subject: Redifining yielding for operations a bit, making further refinements. --- includes/Task.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'includes') diff --git a/includes/Task.h b/includes/Task.h index 27ba4b1..9347dc4 100644 --- a/includes/Task.h +++ b/includes/Task.h @@ -151,12 +151,21 @@ class Task { Task * t = getCurrentTask(); t->waitFor(evt); } - static void yield(Events::BaseEvent * evt, bool interruptible = false) throw (GeneralException); + enum OperationYieldType { + SIMPLE, + INTERRUPTIBLE, + STACKLESS, + }; + static void operationYield(Events::BaseEvent * evt = NULL, enum OperationYieldType yieldType = SIMPLE) throw (GeneralException); TaskMan * getTaskMan() const { return m_taskMan; } 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(); + } virtual void Do() = 0; void waitFor(Events::BaseEvent * event); bool setOkayToEAgain(bool enable) { -- cgit v1.2.3