diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2013-08-02 17:23:00 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2013-08-02 17:31:45 -0400 |
| commit | 43fecf3556b47305320221586f48f89fe2f6c505 (patch) | |
| tree | 5942120bc4dba4d4b2da56457b425145030daf29 /src/libstd/rt | |
| parent | 92f60f4365beb7b0677b196b1650069bd88cb616 (diff) | |
Add an assert_may_sleep() check on every context switch.
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/sched.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index 36b98125229..dfe003253c2 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -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), |
