From 2465a63a69ea51d4fce10430b6a8fd0079cbbcd5 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 3 Mar 2012 02:36:53 -0800 Subject: rt: Move transition from rust_task to rust_task_thread --- src/rt/rust_task_thread.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/rt/rust_task_thread.cpp') diff --git a/src/rt/rust_task_thread.cpp b/src/rt/rust_task_thread.cpp index 472b58f1671..57164a97c0f 100644 --- a/src/rt/rust_task_thread.cpp +++ b/src/rt/rust_task_thread.cpp @@ -319,6 +319,29 @@ rust_task_thread::create_task(rust_task *spawner, const char *name, return task->id; } +void +rust_task_thread::transition(rust_task *task, + rust_task_list *src, rust_task_list *dst, + rust_cond *cond, const char* cond_name) { + bool unlock = false; + if(!lock.lock_held_by_current_thread()) { + unlock = true; + lock.lock(); + } + DLOG(this, task, + "task %s " PTR " state change '%s' -> '%s' while in '%s'", + name, (uintptr_t)this, src->name, dst->name, + task->get_state()->name); + I(this, task->get_state() == src); + src->remove(task); + dst->append(task); + task->set_state(dst, cond, cond_name); + + lock.signal(); + if(unlock) + lock.unlock(); +} + void rust_task_thread::run() { this->start_main_loop(); sched->release_task_thread(); -- cgit 1.4.1-3-g733a5