about summary refs log tree commit diff
path: root/src/libstd/rt/sched.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-08-17 17:40:38 -0700
committerBrian Anderson <banderson@mozilla.com>2013-08-24 15:46:01 -0700
commit761f5fba69edb354cb3a02c01099f00c9bc56dc9 (patch)
tree2a330bc5d2a665a3e06db3ba4af571127ac2ae68 /src/libstd/rt/sched.rs
parent5402786f94feac14adc337055eb0ca6c307b4f67 (diff)
downloadrust-761f5fba69edb354cb3a02c01099f00c9bc56dc9.tar.gz
rust-761f5fba69edb354cb3a02c01099f00c9bc56dc9.zip
std::rt: Optimize TLS use in change_task_context
Diffstat (limited to 'src/libstd/rt/sched.rs')
-rw-r--r--src/libstd/rt/sched.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs
index 111e60ccb2f..b161864a74f 100644
--- a/src/libstd/rt/sched.rs
+++ b/src/libstd/rt/sched.rs
@@ -505,7 +505,9 @@ impl Scheduler {
         let mut this = self;
 
         // The current task is grabbed from TLS, not taken as an input.
-        let current_task: ~Task = Local::take::<Task>();
+        // Doing an unsafe_take to avoid writing back a null pointer -
+        // We're going to call `put` later to do that.
+        let current_task: ~Task = unsafe { Local::unsafe_take::<Task>() };
 
         // Check that the task is not in an atomically() section (e.g.,
         // holding a pthread mutex, which could deadlock the scheduler).