diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-08-17 17:40:38 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-08-24 15:46:01 -0700 |
| commit | 761f5fba69edb354cb3a02c01099f00c9bc56dc9 (patch) | |
| tree | 2a330bc5d2a665a3e06db3ba4af571127ac2ae68 /src/libstd/rt/sched.rs | |
| parent | 5402786f94feac14adc337055eb0ca6c307b4f67 (diff) | |
| download | rust-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.rs | 4 |
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). |
