about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-12-28 19:44:52 -0800
committerAlex Crichton <alex@alexcrichton.com>2013-12-31 20:15:03 -0800
commitc22fed9424a907beab53f6c6cd54afeff039f1b3 (patch)
tree36917eae31e165819adbdff2d9aea95b3c3073a8 /src/libstd/rt
parentf3370295b738c8b4c80fa8fc8449c0c3545b1b35 (diff)
downloadrust-c22fed9424a907beab53f6c6cd54afeff039f1b3.tar.gz
rust-c22fed9424a907beab53f6c6cd54afeff039f1b3.zip
Convert relevant static mutexes to Once
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/local_ptr.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/libstd/rt/local_ptr.rs b/src/libstd/rt/local_ptr.rs
index 42cce272e44..f13691a7bfe 100644
--- a/src/libstd/rt/local_ptr.rs
+++ b/src/libstd/rt/local_ptr.rs
@@ -160,30 +160,20 @@ pub mod native {
     use option::{Option, Some, None};
     use ptr;
     use tls = rt::thread_local_storage;
-    use unstable::mutex::{Mutex, MUTEX_INIT};
 
-    static mut LOCK: Mutex = MUTEX_INIT;
-    static mut INITIALIZED: bool = false;
     static mut RT_TLS_KEY: tls::Key = -1;
 
     /// Initialize the TLS key. Other ops will fail if this isn't executed
     /// first.
     pub fn init() {
         unsafe {
-            LOCK.lock();
-            if !INITIALIZED {
-                tls::create(&mut RT_TLS_KEY);
-                INITIALIZED = true;
-            }
-            LOCK.unlock();
+            tls::create(&mut RT_TLS_KEY);
         }
     }
 
     pub unsafe fn cleanup() {
-        rtassert!(INITIALIZED);
+        rtassert!(RT_TLS_KEY != -1);
         tls::destroy(RT_TLS_KEY);
-        LOCK.destroy();
-        INITIALIZED = false;
     }
 
     /// Give a pointer to thread-local storage.