Skip to content

Commit efd305e

Browse files
committed
Simplify load/store
1 parent b631ca0 commit efd305e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

library/std/src/sys/windows/compat.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,8 @@ pub(super) fn load_synch_functions() {
214214
Some(())
215215
}
216216

217-
// Shortcut if we've already tried (and failed) to load the library.
217+
// Try to load the module but skip loading if a previous attempt failed.
218218
static LOAD_MODULE: AtomicBool = AtomicBool::new(true);
219-
if LOAD_MODULE.load(Ordering::Acquire) {
220-
if try_load().is_none() {
221-
LOAD_MODULE.store(false, Ordering::Release);
222-
}
223-
}
219+
let module_loaded = LOAD_MODULE.load(Ordering::Acquire) && try_load().is_some();
220+
LOAD_MODULE.store(module_loaded, Ordering::Release)
224221
}

0 commit comments

Comments
 (0)