Skip to main content

relibc/header/pthread/
once.rs

1use super::*;
2
3// PTHREAD_ONCE_INIT
4
5/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_once.html>.
6#[unsafe(no_mangle)]
7pub unsafe extern "C" fn pthread_once(
8    once: *mut pthread_once_t,
9    constructor: extern "C" fn(),
10) -> c_int {
11    let once = unsafe { &*once.cast::<RlctOnce>() };
12
13    // TODO: Cancellation points
14
15    once.call_once(|| constructor());
16
17    //crate::sync::once::call_once_generic(&once.inner, || constructor());
18
19    0
20}
21pub(crate) type RlctOnce = crate::sync::Once<()>;