]> git.lizzy.rs Git - rust.git/commitdiff
Guard a maybe_yield in Chan with can_resched
authorAlex Crichton <alex@alexcrichton.com>
Sat, 28 Dec 2013 19:25:28 +0000 (11:25 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 28 Dec 2013 19:25:28 +0000 (11:25 -0800)
I forgot to add this back in after I removed can_resched and then realized I had
to add it back.

src/libstd/comm/mod.rs

index 21db234122b2e662358c712199004c9504e9e658..26e235e6d52698edecd87db197839e3f50580ca6 100644 (file)
@@ -599,7 +599,7 @@ fn try(&self, t: T, can_resched: bool) -> bool {
                 // the TLS overhead can be a bit much.
                 n => {
                     assert!(n >= 0);
-                    if n > 0 && n % RESCHED_FREQ == 0 {
+                    if can_resched && n > 0 && n % RESCHED_FREQ == 0 {
                         let task: ~Task = Local::take();
                         task.maybe_yield();
                     }