rt: Remove rust_task_thread::newborn_tasks

This commit is contained in:
Brian Anderson 2012-03-17 18:29:10 -07:00
parent 5d4bf75f56
commit 6f6650e726
2 changed files with 10 additions and 11 deletions

View File

@ -255,7 +255,6 @@ rust_task_thread::start_main_loop() {
reap_dead_tasks(); reap_dead_tasks();
} }
A(this, newborn_tasks.is_empty(), "Should have no newborn tasks");
A(this, running_tasks.is_empty(), "Should have no running tasks"); A(this, running_tasks.is_empty(), "Should have no running tasks");
A(this, blocked_tasks.is_empty(), "Should have no blocked tasks"); A(this, blocked_tasks.is_empty(), "Should have no blocked tasks");
A(this, dead_tasks.is_empty(), "Should have no dead tasks"); A(this, dead_tasks.is_empty(), "Should have no dead tasks");
@ -280,11 +279,6 @@ rust_task_thread::create_task(rust_task *spawner, const char *name,
DLOG(this, task, "created task: " PTR ", spawner: %s, name: %s", DLOG(this, task, "created task: " PTR ", spawner: %s, name: %s",
task, spawner ? spawner->name : "null", name); task, spawner ? spawner->name : "null", name);
{
scoped_lock with(lock);
newborn_tasks.append(task);
}
task->id = kernel->generate_task_id(); task->id = kernel->generate_task_id();
return task; return task;
} }
@ -292,14 +286,14 @@ rust_task_thread::create_task(rust_task *spawner, const char *name,
rust_task_list * rust_task_list *
rust_task_thread::state_list(rust_task_state state) { rust_task_thread::state_list(rust_task_state state) {
switch (state) { switch (state) {
case task_state_newborn:
return &newborn_tasks;
case task_state_running: case task_state_running:
return &running_tasks; return &running_tasks;
case task_state_blocked: case task_state_blocked:
return &blocked_tasks; return &blocked_tasks;
case task_state_dead: case task_state_dead:
return &dead_tasks; return &dead_tasks;
default:
return NULL;
} }
} }
@ -330,8 +324,14 @@ rust_task_thread::transition(rust_task *task,
name, (uintptr_t)this, state_name(src), state_name(dst), name, (uintptr_t)this, state_name(src), state_name(dst),
state_name(task->get_state())); state_name(task->get_state()));
I(this, task->get_state() == src); I(this, task->get_state() == src);
state_list(src)->remove(task); rust_task_list *src_list = state_list(src);
state_list(dst)->append(task); if (src_list) {
src_list->remove(task);
}
rust_task_list *dst_list = state_list(dst);
if (dst_list) {
dst_list->append(task);
}
task->set_state(dst, cond, cond_name); task->set_state(dst, cond, cond_name);
lock.signal(); lock.signal();

View File

@ -47,7 +47,6 @@ private:
stk_seg *cached_c_stack; stk_seg *cached_c_stack;
stk_seg *extra_c_stack; stk_seg *extra_c_stack;
rust_task_list newborn_tasks;
rust_task_list running_tasks; rust_task_list running_tasks;
rust_task_list blocked_tasks; rust_task_list blocked_tasks;
rust_task_list dead_tasks; rust_task_list dead_tasks;