Skip to content

Commit

Permalink
avoid unnecessary Thread handle allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
joboet committed Apr 15, 2023
1 parent b5d8108 commit e277f01
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/std/src/sys/unix/locks/queue_rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit e277f01

Please sign in to comment.