Skip to content

Commit

Permalink
Thread stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
terrarier2111 committed Jul 20, 2023
1 parent 3463c02 commit a121f5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

#![warn(missing_docs)]
#![allow(clippy::mutex_atomic)]
#![cfg_attr(feature = "nightly", feature(thread_local))]
#![cfg_attr(feature = "nightly", feature(thread_local, core_intrinsics))]

mod cached;
mod mutex;
Expand Down
3 changes: 2 additions & 1 deletion src/thread_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use std::{mem, ptr};
use std::mem::MaybeUninit;
use std::num::NonZeroUsize;
use std::ptr::addr_of;
use likely_stable::likely;

/// Thread ID manager which allocates thread IDs. It attempts to aggressively
/// reuse thread IDs where possible to avoid cases where a ThreadLocal grows
Expand Down Expand Up @@ -139,6 +138,8 @@ cfg_if::cfg_if! {
/// Returns a thread ID for the current thread, allocating one if needed.
#[inline]
pub(crate) fn get() -> Thread {
use std::intrinsics::likely;
// prefetch_read_data();
let thread = unsafe { *THREAD.get() };
if likely(thread.init) {
thread
Expand Down

0 comments on commit a121f5f

Please sign in to comment.