From e1f011cbce057e0d4452f8c91329afa1ac3a80a3 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Wed, 7 Aug 2013 15:06:18 -0700 Subject: Adding yieldNoWait() for tasks that just want to let the scheduler switch back and forth because of CPU usage. --- includes/Task.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'includes/Task.h') diff --git a/includes/Task.h b/includes/Task.h index 6fa2161..a3dbb48 100644 --- a/includes/Task.h +++ b/includes/Task.h @@ -183,6 +183,12 @@ class Task { throw TaskSwitch(); } } + void yieldNoWait() throw (GeneralException) { + if (yield(true)) { + AAssert(!m_cannotEAgain, "task at %p in simple context mode can't TaskSwitch", this); + throw TaskSwitch(); + } + } virtual void Do() = 0; void waitFor(Events::BaseEvent * event); void sleep(double timeout); -- cgit v1.2.3