avoid unnecessary Thread handle allocation

This commit is contained in:
joboet 2023-04-12 21:48:12 +02:00
parent 280cbc5dae
commit 709ccf98b8
No known key found for this signature in database
GPG Key ID: 704E0149B0194B3C

View File

@ -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);
}