summaryrefslogtreecommitdiff
path: root/includes/Task.h
diff options
context:
space:
mode:
authorNicolas Noble <pixel@nobis-crew.org>2013-08-07 15:06:18 -0700
committerNicolas Noble <pixel@nobis-crew.org>2013-08-07 15:06:18 -0700
commite1f011cbce057e0d4452f8c91329afa1ac3a80a3 (patch)
treea7600b7849879634ca1d248a62f209f3084f6639 /includes/Task.h
parentb480f2b95350b2e8d0fcbaeb40872b6effc8a291 (diff)
Adding yieldNoWait() for tasks that just want to let the scheduler switch back and forth because of CPU usage.
Diffstat (limited to 'includes/Task.h')
-rw-r--r--includes/Task.h6
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);