about summary refs log tree commit diff
path: root/src/libstd/thread_local
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-12-23 02:41:48 +0000
committerbors <bors@rust-lang.org>2014-12-23 02:41:48 +0000
commit62fb41c32bd97c4e9bc286a1db5d7126a06b8b91 (patch)
treefc1c7ab2bf1a29879d45235acaf0126ceae4d107 /src/libstd/thread_local
parent2f3cff6956d56048ef7afb6d33e17cbdb2dcf038 (diff)
parent3583d613b9c81855feb067aeeebb525cf8a4184c (diff)
downloadrust-62fb41c32bd97c4e9bc286a1db5d7126a06b8b91.tar.gz
rust-62fb41c32bd97c4e9bc286a1db5d7126a06b8b91.zip
auto merge of #20145 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/libstd/thread_local')
-rw-r--r--src/libstd/thread_local/mod.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/libstd/thread_local/mod.rs b/src/libstd/thread_local/mod.rs
index 4c33d1c418d..04718dcc6ae 100644
--- a/src/libstd/thread_local/mod.rs
+++ b/src/libstd/thread_local/mod.rs
@@ -189,11 +189,12 @@ macro_rules! __thread_local_inner {
             }
         };
 
-        #[cfg(not(any(target_os = "macos", target_os = "linux")))]
+        #[cfg(all(stage0, not(any(target_os = "macos", target_os = "linux"))))]
         const INIT: ::std::thread_local::KeyInner<$t> = {
             unsafe extern fn __destroy(ptr: *mut u8) {
                 ::std::thread_local::destroy_value::<$t>(ptr);
             }
+
             ::std::thread_local::KeyInner {
                 inner: ::std::cell::UnsafeCell { value: $init },
                 os: ::std::thread_local::OsStaticKey {
@@ -203,6 +204,21 @@ macro_rules! __thread_local_inner {
             }
         };
 
+        #[cfg(all(not(stage0), not(any(target_os = "macos", target_os = "linux"))))]
+        const INIT: ::std::thread_local::KeyInner<$t> = {
+            unsafe extern fn __destroy(ptr: *mut u8) {
+                ::std::thread_local::destroy_value::<$t>(ptr);
+            }
+
+            ::std::thread_local::KeyInner {
+                inner: ::std::cell::UnsafeCell { value: $init },
+                os: ::std::thread_local::OsStaticKey {
+                    inner: ::std::thread_local::OS_INIT_INNER,
+                    dtor: ::std::option::Option::Some(__destroy as unsafe extern fn(*mut u8)),
+                },
+            }
+        };
+
         INIT
     });
 }
@@ -323,6 +339,12 @@ mod imp {
         // *should* be the case that this loop always terminates because we
         // provide the guarantee that a TLS key cannot be set after it is
         // flagged for destruction.
+        #[cfg(not(stage0))]
+        static DTORS: os::StaticKey = os::StaticKey {
+            inner: os::INIT_INNER,
+            dtor: Some(run_dtors as unsafe extern "C" fn(*mut u8)),
+        };
+        #[cfg(stage0)]
         static DTORS: os::StaticKey = os::StaticKey {
             inner: os::INIT_INNER,
             dtor: Some(run_dtors),