diff options
| author | joboet <jonasboettiger@icloud.com> | 2023-04-12 21:48:12 +0200 |
|---|---|---|
| committer | joboet <jonasboettiger@icloud.com> | 2024-02-09 14:58:37 +0100 |
| commit | 709ccf98b8f646629150c9b1dfa536dd2b905d10 (patch) | |
| tree | 05fcba649b22e40e2b676a6a85fadf7d4efdd2f4 /library/std/src/sys | |
| parent | 280cbc5dae34fda2e1816b44db7c1eb98f6b4ad2 (diff) | |
| download | rust-709ccf98b8f646629150c9b1dfa536dd2b905d10.tar.gz rust-709ccf98b8f646629150c9b1dfa536dd2b905d10.zip | |
avoid unnecessary `Thread` handle allocation
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/pal/unix/locks/queue_rwlock.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/std/src/sys/pal/unix/locks/queue_rwlock.rs b/library/std/src/sys/pal/unix/locks/queue_rwlock.rs index 25a010a1e89..1719a56087a 100644 --- a/library/std/src/sys/pal/unix/locks/queue_rwlock.rs +++ b/library/std/src/sys/pal/unix/locks/queue_rwlock.rs @@ -210,7 +210,8 @@ impl Node { fn prepare(&mut self) { // Fall back to creating an unnamed `Thread` handle to allow locking in // TLS destructors. - self.thread.get_or_init(|| thread_info::current_thread().unwrap_or(Thread::new(None))); + self.thread + .get_or_init(|| thread_info::current_thread().unwrap_or_else(|| Thread::new(None))); self.completed = AtomicBool::new(false); } |
