Add an assert_may_sleep() check on every context switch.
This commit is contained in:
parent
92f60f4365
commit
43fecf3556
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user