diff options
| author | Kevin Ballard <kevin@sb.org> | 2013-08-16 12:49:40 -0700 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2013-08-16 13:26:50 -0700 |
| commit | 418e1ebae6ed543b1a78c3e987d42bf0bf25f310 (patch) | |
| tree | 6fe66cd490adb82b0e712f4e34b6fa331ad4ba18 /src/libstd/task | |
| parent | 680eb71564ebba5e76ce1e1a8287b30042332cc5 (diff) | |
| download | rust-418e1ebae6ed543b1a78c3e987d42bf0bf25f310.tar.gz rust-418e1ebae6ed543b1a78c3e987d42bf0bf25f310.zip | |
Reserve 'yield' keyword
Rename task::yield() to task::deschedule(). Fixes #8494.
Diffstat (limited to 'src/libstd/task')
| -rw-r--r-- | src/libstd/task/mod.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index c38e6f23313..ab1d831f089 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -537,7 +537,7 @@ pub fn with_task_name<U>(blk: &fn(Option<&str>) -> U) -> U { } } -pub fn yield() { +pub fn deschedule() { //! Yield control to the task scheduler use rt::local::Local; @@ -568,10 +568,10 @@ pub fn failing() -> bool { * * ~~~ * do task::unkillable { - * // detach / yield / destroy must all be called together + * // detach / deschedule / destroy must all be called together * rustrt::rust_port_detach(po); * // This must not result in the current task being killed - * task::yield(); + * task::deschedule(); * rustrt::rust_port_destroy(po); * } * ~~~ @@ -689,7 +689,7 @@ fn test_spawn_unlinked_unsup_no_fail_down() { // grandchild sends on a port let ch = ch.clone(); do spawn_unlinked { // Give middle task a chance to fail-but-not-kill-us. - do 16.times { task::yield(); } + do 16.times { task::deschedule(); } ch.send(()); // If killed first, grandparent hangs. } fail!(); // Shouldn't kill either (grand)parent or (grand)child. @@ -712,7 +712,7 @@ fn test_spawn_unlinked_sup_no_fail_up() { // child unlinked fails do run_in_newsched_task { do spawn_supervised { fail!(); } // Give child a chance to fail-but-not-kill-us. - do 16.times { task::yield(); } + do 16.times { task::deschedule(); } } } #[ignore(reason = "linked failure")] @@ -821,7 +821,7 @@ fn test_spawn_failure_propagate_grandchild() { do spawn_supervised { do spawn_supervised { block_forever(); } } - do 16.times { task::yield(); } + do 16.times { task::deschedule(); } fail!(); }; assert!(result.is_err()); @@ -838,7 +838,7 @@ fn test_spawn_failure_propagate_secondborn() { do spawn_supervised { do spawn { block_forever(); } // linked } - do 16.times { task::yield(); } + do 16.times { task::deschedule(); } fail!(); }; assert!(result.is_err()); @@ -855,7 +855,7 @@ fn test_spawn_failure_propagate_nephew_or_niece() { do spawn { // linked do spawn_supervised { block_forever(); } } - do 16.times { task::yield(); } + do 16.times { task::deschedule(); } fail!(); }; assert!(result.is_err()); @@ -872,7 +872,7 @@ fn test_spawn_linked_sup_propagate_sibling() { do spawn { // linked do spawn { block_forever(); } // linked } - do 16.times { task::yield(); } + do 16.times { task::deschedule(); } fail!(); }; assert!(result.is_err()); @@ -1169,12 +1169,12 @@ fn test_unkillable() { // We want to do this after failing do spawn_unlinked { - do 10.times { yield() } + do 10.times { deschedule() } ch.send(()); } do spawn { - yield(); + deschedule(); // We want to fail after the unkillable task // blocks on recv fail!(); @@ -1205,12 +1205,12 @@ fn test_unkillable_nested() { // We want to do this after failing do spawn_unlinked || { - do 10.times { yield() } + do 10.times { deschedule() } ch.send(()); } do spawn { - yield(); + deschedule(); // We want to fail after the unkillable task // blocks on recv fail!(); @@ -1277,7 +1277,7 @@ fn test_spawn_watched() { t.unlinked(); t.watched(); do t.spawn { - task::yield(); + task::deschedule(); fail!(); } } @@ -1313,7 +1313,7 @@ fn test_indestructible() { t.unwatched(); do t.spawn { p3.recv(); - task::yield(); + task::deschedule(); fail!(); } c3.send(()); |
