diff options
| author | tyler <tyler@brainiumstudios.com> | 2019-04-30 18:24:38 -0700 |
|---|---|---|
| committer | tyler <tyler@brainiumstudios.com> | 2019-05-15 07:30:33 -0700 |
| commit | 7acfb99adc013d4b77c611cfc51bade551205f5a (patch) | |
| tree | 59461cea814349005ab153ae4ebb218f0b9441eb /src/libstd/thread | |
| parent | 430a091cd80c0e4b6bf44f6a19463a832e566f97 (diff) | |
| download | rust-7acfb99adc013d4b77c611cfc51bade551205f5a.tar.gz rust-7acfb99adc013d4b77c611cfc51bade551205f5a.zip | |
Revert "ensure fast thread local lookups occur once per access on macos"
This reverts commit d252f3b77f3b7d4cd59620588f9d026633c05816.
Diffstat (limited to 'src/libstd/thread')
| -rw-r--r-- | src/libstd/thread/local.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 9ce2fcf2352..0d5e1f2af38 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -344,7 +344,7 @@ pub mod fast { use crate::fmt; use crate::mem; use crate::ptr; - use crate::sys::fast_thread_local::{lookup_once, register_dtor}; + use crate::sys::fast_thread_local::register_dtor; pub struct Key<T> { inner: UnsafeCell<Option<T>>, @@ -371,12 +371,11 @@ pub mod fast { } pub unsafe fn get(&self) -> Option<&'static UnsafeCell<Option<T>>> { - let this = lookup_once(&self); - if mem::needs_drop::<T>() && this.dtor_running.get() { + if mem::needs_drop::<T>() && self.dtor_running.get() { return None } - this.register_dtor(); - Some(&*(&this.inner as *const _)) + self.register_dtor(); + Some(&*(&self.inner as *const _)) } unsafe fn register_dtor(&self) { @@ -396,7 +395,7 @@ pub mod fast { // destructor as running for this thread so calls to `get` will return // `None`. (*ptr).dtor_running.set(true); - + ptr::drop_in_place((*ptr).inner.get()); } } |
