diff options
Diffstat (limited to 'lib/Task.cc')
-rw-r--r-- | lib/Task.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/Task.cc b/lib/Task.cc index 0b19ab3..6493111 100644 --- a/lib/Task.cc +++ b/lib/Task.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Task.cc,v 1.33 2007-05-30 11:57:10 pixel Exp $ */ +/* $Id: Task.cc,v 1.34 2008-02-18 09:55:08 pixel Exp $ */ #ifndef _WIN32 #include <sys/time.h> @@ -31,7 +31,7 @@ #include "BString.h" #include "gettext.h" -Task::Task() : current(0), state(TASK_ON_HOLD), stopped(false), suspended(false), wbta(0), wta(0), BurstHandle(0) { +Task::Task() : current(0), state(TASK_ON_HOLD), stopped(false), suspended(false), yielded(false), wbta(0), wta(0), BurstHandle(0) { TaskMan::AddTask(this); } @@ -116,6 +116,20 @@ void Task::WaitFor(const timeval & t, int flags) { TaskMan::WaitFor(t, this, flags); } +void Task::Yield() { + yielded = true; + Suspend(TASK_ON_HOLD); +} + +bool Task::Yielded() { + return yielded; +} + +void Task::Unyield() { + yielded = false; + SetBurst(); +} + void Task::SetBurst() { state = TASK_BURST; } |