Skip to content

Commit 58e109a

Browse files
committed
global_registry() must sync through THE_REGISTRY_SET
1 parent 6410e79 commit 58e109a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

rayon-core/src/registry.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,9 @@ static THE_REGISTRY_SET: Once = ONCE_INIT;
103103
/// initialization has not already occurred, use the default
104104
/// configuration.
105105
fn global_registry() -> &'static Arc<Registry> {
106-
unsafe {
107-
THE_REGISTRY.unwrap_or_else(|| {
108-
init_global_registry(ThreadPoolBuilder::new())
109-
.expect("The global thread pool has not been initialized.")
110-
})
111-
}
106+
set_global_registry(|| Registry::new(ThreadPoolBuilder::new()))
107+
.or_else(|err| unsafe { THE_REGISTRY.ok_or(err) })
108+
.expect("The global thread pool has not been initialized.")
112109
}
113110

114111
/// Starts the worker threads (if that has not already happened) with

0 commit comments

Comments
 (0)