Add an assert_may_sleep() check on every context switch.

This commit is contained in:
Ben Blum 2013-08-02 17:23:00 -04:00
parent 92f60f4365
commit 43fecf3556

View File

@ -540,6 +540,10 @@ impl Scheduler {
// The current task is grabbed from TLS, not taken as an input.
let current_task: ~Task = Local::take::<Task>();
// Check that the task is not in an atomically() section (e.g.,
// holding a pthread mutex, which could deadlock the scheduler).
current_task.death.assert_may_sleep();
// These transmutes do something fishy with a closure.
let f_fake_region = unsafe {
transmute::<&fn(&mut Scheduler, ~Task),