diff options
author | Haibo Huang <hhb@google.com> | 2021-02-19 18:00:15 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-02-19 18:00:15 +0000 |
commit | 2db876130ecf789755a47f29f08661b04ff194a8 (patch) | |
tree | d44255fadd7cd31117a35a02485877a5a63ceb6f /src/thread_id.rs | |
parent | f9650f5f4015c2f1a3a6b94d634c22040ea8e633 (diff) | |
parent | 535cf3a070c95c75bdfb08e4c858ef411beb4f42 (diff) | |
download | thread_local-2db876130ecf789755a47f29f08661b04ff194a8.tar.gz |
Upgrade rust/crates/thread_local to 1.1.3 am: c37c85bc7a am: eff59296dc am: 1ca7eb5dcf am: 535cf3a070
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/thread_local/+/1581973
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I92e1a91861c636ce4b4ef2c87f6f40a7a2f41f39
Diffstat (limited to 'src/thread_id.rs')
-rw-r--r-- | src/thread_id.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/thread_id.rs b/src/thread_id.rs index 397f772..6eb0f61 100644 --- a/src/thread_id.rs +++ b/src/thread_id.rs @@ -5,11 +5,12 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. +use crate::POINTER_WIDTH; +use once_cell::sync::Lazy; use std::cmp::Reverse; use std::collections::BinaryHeap; use std::sync::Mutex; use std::usize; -use POINTER_WIDTH; /// Thread ID manager which allocates thread IDs. It attempts to aggressively /// reuse thread IDs where possible to avoid cases where a ThreadLocal grows @@ -41,9 +42,8 @@ impl ThreadIdManager { self.free_list.push(Reverse(id)); } } -lazy_static! { - static ref THREAD_ID_MANAGER: Mutex<ThreadIdManager> = Mutex::new(ThreadIdManager::new()); -} +static THREAD_ID_MANAGER: Lazy<Mutex<ThreadIdManager>> = + Lazy::new(|| Mutex::new(ThreadIdManager::new())); /// Data which is unique to the current thread while it is running. /// A thread ID may be reused after a thread exits. |