Lock the new task's scheduler when creating a task

Previously we were locking the spawning task's scheduler. I couldn't
see that that was protecting anything. The newborn_task list in the new task's
scheduler though was unprotected from concurrent access. So now we're locking
the new task's scheduler.
This commit is contained in:
Brian Anderson
2011-07-29 21:43:22 -07:00
parent 96a629d2fa
commit 6657e729de
2 changed files with 3 additions and 2 deletions

View File

@@ -135,7 +135,9 @@ int rust_kernel::start_task_threads()
rust_task *
rust_kernel::create_task(rust_task *spawner, const char *name) {
return threads[rand(&rctx) % num_threads]->create_task(spawner, name);
rust_scheduler *thread = threads[rand(&rctx) % num_threads];
scoped_lock with(thread->lock);
return thread->create_task(spawner, name);
}
void rust_kernel::wakeup_schedulers() {