Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace pthread RwLock with custom implementation #110211

Merged
merged 12 commits into from
Feb 12, 2024
Prev Previous commit
Next Next commit
avoid unnecessary Thread handle allocation
  • Loading branch information
joboet committed Feb 9, 2024
commit 709ccf98b8f646629150c9b1dfa536dd2b905d10
3 changes: 2 additions & 1 deletion library/std/src/sys/pal/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