diff options
author | Nicolas Noble <pixel@nobis-crew.org> | 2013-08-07 15:06:18 -0700 |
---|---|---|
committer | Nicolas Noble <pixel@nobis-crew.org> | 2013-08-07 15:06:18 -0700 |
commit | e1f011cbce057e0d4452f8c91329afa1ac3a80a3 (patch) | |
tree | a7600b7849879634ca1d248a62f209f3084f6639 | |
parent | b480f2b95350b2e8d0fcbaeb40872b6effc8a291 (diff) |
Adding yieldNoWait() for tasks that just want to let the scheduler switch back and forth because of CPU usage.
-rw-r--r-- | includes/Task.h | 6 |
1 files changed, 6 insertions, 0 deletions
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); |