about summary refs log tree commit diff
path: root/library/std/src/sys/sync/rwlock/queue.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-11-24 23:17:56 +0000
committerbors <bors@rust-lang.org>2024-11-24 23:17:56 +0000
commit28fc2ba7142654fa6e654926f96ff913027b200e (patch)
tree47ce907833aa4d4b770a5bb17ee0ebeac61b1c68 /library/std/src/sys/sync/rwlock/queue.rs
parent481b5fadd7994d0f04e9a6fe9ded3f22d6753825 (diff)
parentc50e19b69cf7f26fcd289c32a4f69adda5bc9470 (diff)
downloadrust-28fc2ba7142654fa6e654926f96ff913027b200e.tar.gz
rust-28fc2ba7142654fa6e654926f96ff913027b200e.zip
Auto merge of #133423 - jieyouxu:rollup-m3gyoz6, r=jieyouxu
Rollup of 6 pull requests

Successful merges:

 - #132730 (std: allow after-main use of synchronization primitives)
 - #133105 (only store valid proc macro item for doc link)
 - #133260 (Constify the `Deref`/`DerefMut` traits, too)
 - #133297 (Remove legacy bitcode for iOS)
 - #133298 (Mention that std::fs::remove_dir_all fails on files)
 - #133384 (add a test for target-feature-ABI warnings in closures and when calling extern fn)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/sys/sync/rwlock/queue.rs')
-rw-r--r--library/std/src/sys/sync/rwlock/queue.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/library/std/src/sys/sync/rwlock/queue.rs b/library/std/src/sys/sync/rwlock/queue.rs
index 51330f8fafe..bd15f8ee952 100644
--- a/library/std/src/sys/sync/rwlock/queue.rs
+++ b/library/std/src/sys/sync/rwlock/queue.rs
@@ -118,7 +118,7 @@ use crate::mem;
 use crate::ptr::{self, NonNull, null_mut, without_provenance_mut};
 use crate::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
 use crate::sync::atomic::{AtomicBool, AtomicPtr};
-use crate::thread::{self, Thread, ThreadId};
+use crate::thread::{self, Thread};
 
 /// The atomic lock state.
 type AtomicState = AtomicPtr<()>;
@@ -217,9 +217,7 @@ impl Node {
     /// Prepare this node for waiting.
     fn prepare(&mut self) {
         // Fall back to creating an unnamed `Thread` handle to allow locking in TLS destructors.
-        self.thread.get_or_init(|| {
-            thread::try_current().unwrap_or_else(|| Thread::new_unnamed(ThreadId::new()))
-        });
+        self.thread.get_or_init(thread::current_or_unnamed);
         self.completed = AtomicBool::new(false);
     }