diff options
Diffstat (limited to 'components/util')
-rw-r--r-- | components/util/lib.rs | 1 | ||||
-rw-r--r-- | components/util/tid.rs | 26 |
2 files changed, 0 insertions, 27 deletions
diff --git a/components/util/lib.rs b/components/util/lib.rs index fed8c9b0178..3f120cb06bf 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -42,7 +42,6 @@ pub mod resource_files; pub mod str; pub mod thread; pub mod thread_state; -pub mod tid; #[cfg(feature = "servo")] #[allow(unsafe_code)] diff --git a/components/util/tid.rs b/components/util/tid.rs deleted file mode 100644 index a60c321a984..00000000000 --- a/components/util/tid.rs +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -use std::cell::RefCell; -use std::rc::Rc; -use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; - -static NEXT_TID: AtomicUsize = ATOMIC_USIZE_INIT; - -thread_local!(static TASK_LOCAL_TID: Rc<RefCell<Option<usize>>> = Rc::new(RefCell::new(None))); - -/// Every thread gets one, that's unique. -pub fn tid() -> usize { - TASK_LOCAL_TID.with(|ref k| { - let ret = - match *k.borrow() { - None => NEXT_TID.fetch_add(1, Ordering::SeqCst), - Some(x) => x, - }; - - *k.borrow_mut() = Some(ret); - - ret - }) -} |