diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2013-07-30 21:38:44 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2013-07-31 14:37:22 -0400 |
| commit | bc7cee7bbf816be7a712c06a93015dc3c6fd5611 (patch) | |
| tree | 2d4052b11459f0f8a2f4e8ccf98e3112c824b39b /src/libstd/task | |
| parent | 2e6dc161b6efac1ce2709ab4e1c05c55c01e3abf (diff) | |
| download | rust-bc7cee7bbf816be7a712c06a93015dc3c6fd5611.tar.gz rust-bc7cee7bbf816be7a712c06a93015dc3c6fd5611.zip | |
Move atomically to unstable::sync, and document what it actually does. Close #7872.
Diffstat (limited to 'src/libstd/task')
| -rw-r--r-- | src/libstd/task/mod.rs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index 29a0dc9e337..aff4bc12039 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -655,44 +655,6 @@ pub unsafe fn rekillable<U>(f: &fn() -> U) -> U { } } -/** - * A stronger version of unkillable that also inhibits scheduling operations. - * For use with exclusive Arcs, which use pthread mutexes directly. - */ -pub unsafe fn atomically<U>(f: &fn() -> U) -> U { - use rt::task::Task; - - match context() { - OldTaskContext => { - let t = rt::rust_get_task(); - do (|| { - rt::rust_task_inhibit_kill(t); - rt::rust_task_inhibit_yield(t); - f() - }).finally { - rt::rust_task_allow_yield(t); - rt::rust_task_allow_kill(t); - } - } - TaskContext => { - let t = Local::unsafe_borrow::<Task>(); - do (|| { - // It's important to inhibit kill after inhibiting yield, because - // inhibit-kill might fail if we were already killed, and the - // inhibit-yield must happen to match the finally's allow-yield. - (*t).death.inhibit_yield(); - (*t).death.inhibit_kill((*t).unwinder.unwinding); - f() - }).finally { - (*t).death.allow_kill((*t).unwinder.unwinding); - (*t).death.allow_yield(); - } - } - // FIXME(#3095): As in unkillable(). - _ => f() - } -} - #[test] #[should_fail] #[ignore(cfg(windows))] fn test_cant_dup_task_builder() { let mut builder = task(); @@ -1177,21 +1139,6 @@ fn test_unkillable_nested() { po.recv(); } -#[test] #[should_fail] #[ignore(cfg(windows))] -fn test_atomically() { - unsafe { do atomically { yield(); } } -} - -#[test] -fn test_atomically2() { - unsafe { do atomically { } } yield(); // shouldn't fail -} - -#[test] #[should_fail] #[ignore(cfg(windows))] -fn test_atomically_nested() { - unsafe { do atomically { do atomically { } yield(); } } -} - #[test] fn test_child_doesnt_ref_parent() { // If the child refcounts the parent task, this will stack overflow when |
