diff --git a/src/header/pthread/attr.rs b/src/header/pthread/attr.rs index a975f9ea75..b3c27444ae 100644 --- a/src/header/pthread/attr.rs +++ b/src/header/pthread/attr.rs @@ -34,12 +34,14 @@ impl Default for RlctAttr { } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_destroy(attr: *mut pthread_attr_t) -> c_int { unsafe { ptr::drop_in_place(attr) }; 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_getdetachstate( attr: *const pthread_attr_t, @@ -49,6 +51,7 @@ pub unsafe extern "C" fn pthread_attr_getdetachstate( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_getguardsize( attr: *const pthread_attr_t, @@ -58,6 +61,7 @@ pub unsafe extern "C" fn pthread_attr_getguardsize( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_getinheritsched( attr: *const pthread_attr_t, @@ -67,6 +71,7 @@ pub unsafe extern "C" fn pthread_attr_getinheritsched( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_getschedparam( attr: *const pthread_attr_t, @@ -76,6 +81,7 @@ pub unsafe extern "C" fn pthread_attr_getschedparam( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_getschedpolicy( attr: *const pthread_attr_t, @@ -85,6 +91,7 @@ pub unsafe extern "C" fn pthread_attr_getschedpolicy( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_getscope( attr: *const pthread_attr_t, @@ -94,6 +101,7 @@ pub unsafe extern "C" fn pthread_attr_getscope( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_getstack( attr: *const pthread_attr_t, @@ -105,6 +113,7 @@ pub unsafe extern "C" fn pthread_attr_getstack( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_getstacksize( attr: *const pthread_attr_t, @@ -114,12 +123,14 @@ pub unsafe extern "C" fn pthread_attr_getstacksize( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_init(attr: *mut pthread_attr_t) -> c_int { unsafe { ptr::write(attr.cast::(), RlctAttr::default()) }; 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_setdetachstate( attr: *mut pthread_attr_t, @@ -131,6 +142,7 @@ pub unsafe extern "C" fn pthread_attr_setdetachstate( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_setguardsize( attr: *mut pthread_attr_t, @@ -142,6 +154,7 @@ pub unsafe extern "C" fn pthread_attr_setguardsize( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_setinheritsched( attr: *mut pthread_attr_t, @@ -153,6 +166,7 @@ pub unsafe extern "C" fn pthread_attr_setinheritsched( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_setschedparam( attr: *mut pthread_attr_t, @@ -164,6 +178,7 @@ pub unsafe extern "C" fn pthread_attr_setschedparam( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_setschedpolicy( attr: *mut pthread_attr_t, @@ -175,6 +190,7 @@ pub unsafe extern "C" fn pthread_attr_setschedpolicy( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_setscope(attr: *mut pthread_attr_t, scope: c_int) -> c_int { unsafe { @@ -183,6 +199,7 @@ pub unsafe extern "C" fn pthread_attr_setscope(attr: *mut pthread_attr_t, scope: 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_setstack( attr: *mut pthread_attr_t, @@ -198,6 +215,7 @@ pub unsafe extern "C" fn pthread_attr_setstack( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_attr_setstacksize( attr: *mut pthread_attr_t, diff --git a/src/header/pthread/barrier.rs b/src/header/pthread/barrier.rs index dedf715f7e..e579449641 100644 --- a/src/header/pthread/barrier.rs +++ b/src/header/pthread/barrier.rs @@ -22,6 +22,7 @@ impl Default for RlctBarrierAttr { } // Not async-signal-safe. +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> c_int { // Behavior is undefined if any thread is currently waiting when this is called. @@ -33,6 +34,7 @@ pub unsafe extern "C" fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t } // Not async-signal-safe. +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_barrier_init( barrier: *mut pthread_barrier_t, @@ -56,6 +58,7 @@ fn unlikely(condition: bool) -> bool { } // Not async-signal-safe. +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> c_int { let barrier = unsafe { &*barrier.cast::() }; @@ -67,6 +70,7 @@ pub unsafe extern "C" fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) - } // Not async-signal-safe. +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_barrierattr_init(attr: *mut pthread_barrierattr_t) -> c_int { unsafe { core::ptr::write(attr.cast::(), RlctBarrierAttr::default()) }; @@ -75,6 +79,7 @@ pub unsafe extern "C" fn pthread_barrierattr_init(attr: *mut pthread_barrierattr } // Not async-signal-safe. +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_barrierattr_setpshared( attr: *mut pthread_barrierattr_t, @@ -87,6 +92,7 @@ pub unsafe extern "C" fn pthread_barrierattr_setpshared( } // Not async-signal-safe. +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_barrierattr_getpshared( attr: *const pthread_barrierattr_t, @@ -97,6 +103,7 @@ pub unsafe extern "C" fn pthread_barrierattr_getpshared( } // Not async-signal-safe. +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_barrierattr_destroy(attr: *mut pthread_barrierattr_t) -> c_int { unsafe { core::ptr::drop_in_place(attr) }; diff --git a/src/header/pthread/cond.rs b/src/header/pthread/cond.rs index 49467238da..b22dfbcd27 100644 --- a/src/header/pthread/cond.rs +++ b/src/header/pthread/cond.rs @@ -6,11 +6,13 @@ use super::*; // PTHREAD_COND_INITIALIZER is defined manually in bits_pthread/cbindgen.toml +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> c_int { e((unsafe { &*cond.cast::() }).broadcast()) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int { // No-op @@ -18,6 +20,7 @@ pub unsafe extern "C" fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_in 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_cond_init( cond: *mut pthread_cond_t, @@ -37,11 +40,13 @@ pub unsafe extern "C" fn pthread_cond_init( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_cond_signal(cond: *mut pthread_cond_t) -> c_int { e((unsafe { &*cond.cast::() }).signal()) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_cond_timedwait( cond: *mut pthread_cond_t, @@ -52,6 +57,7 @@ pub unsafe extern "C" fn pthread_cond_timedwait( .timedwait(unsafe { &*mutex.cast::() }, unsafe { &*timeout })) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_cond_clockwait( cond: *mut pthread_cond_t, @@ -66,6 +72,7 @@ pub unsafe extern "C" fn pthread_cond_clockwait( )) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_cond_wait( cond: *mut pthread_cond_t, @@ -74,6 +81,7 @@ pub unsafe extern "C" fn pthread_cond_wait( e((unsafe { &*cond.cast::() }).wait(unsafe { &*mutex.cast::() })) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_condattr_destroy(condattr: *mut pthread_condattr_t) -> c_int { unsafe { core::ptr::drop_in_place(condattr.cast::()) }; @@ -81,6 +89,7 @@ pub unsafe extern "C" fn pthread_condattr_destroy(condattr: *mut pthread_condatt 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_condattr_getclock( condattr: *const pthread_condattr_t, @@ -90,6 +99,7 @@ pub unsafe extern "C" fn pthread_condattr_getclock( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_condattr_getpshared( condattr: *const pthread_condattr_t, @@ -99,6 +109,7 @@ pub unsafe extern "C" fn pthread_condattr_getpshared( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_condattr_init(condattr: *mut pthread_condattr_t) -> c_int { unsafe { @@ -109,6 +120,7 @@ pub unsafe extern "C" fn pthread_condattr_init(condattr: *mut pthread_condattr_t 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_condattr_setclock( condattr: *mut pthread_condattr_t, @@ -118,6 +130,7 @@ pub unsafe extern "C" fn pthread_condattr_setclock( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_condattr_setpshared( condattr: *mut pthread_condattr_t, diff --git a/src/header/pthread/mutex.rs b/src/header/pthread/mutex.rs index 67c802aeef..797b5897a0 100644 --- a/src/header/pthread/mutex.rs +++ b/src/header/pthread/mutex.rs @@ -8,10 +8,12 @@ use crate::{error::Errno, header::time::timespec_realtime_to_monotonic}; // PTHREAD_MUTEX_INITIALIZER is defined in bits_pthread/cbindgen.toml +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> c_int { e((unsafe { &*mutex.cast::() }).make_consistent()) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> c_int { // No-op @@ -19,6 +21,7 @@ pub unsafe extern "C" fn pthread_mutex_destroy(mutex: *mut pthread_mutex_t) -> c 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutex_getprioceiling( mutex: *const pthread_mutex_t, @@ -33,6 +36,7 @@ pub unsafe extern "C" fn pthread_mutex_getprioceiling( } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutex_init( mutex: *mut pthread_mutex_t, @@ -51,11 +55,13 @@ pub unsafe extern "C" fn pthread_mutex_init( Err(Errno(errno)) => errno, } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutex_lock(mutex: *mut pthread_mutex_t) -> c_int { e((unsafe { &*mutex.cast::() }).lock()) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutex_setprioceiling( mutex: *mut pthread_mutex_t, @@ -71,6 +77,7 @@ pub unsafe extern "C" fn pthread_mutex_setprioceiling( } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutex_timedlock( mutex: *mut pthread_mutex_t, @@ -84,15 +91,18 @@ pub unsafe extern "C" fn pthread_mutex_timedlock( e((unsafe { &*mutex.cast::() }).lock_with_timeout(&relative)) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> c_int { e((unsafe { &*mutex.cast::() }).try_lock()) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> c_int { e((unsafe { &*mutex.cast::() }).unlock()) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int { // No-op @@ -100,6 +110,7 @@ pub unsafe extern "C" fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_ 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_getprioceiling( attr: *const pthread_mutexattr_t, @@ -109,6 +120,7 @@ pub unsafe extern "C" fn pthread_mutexattr_getprioceiling( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_getprotocol( attr: *const pthread_mutexattr_t, @@ -118,6 +130,7 @@ pub unsafe extern "C" fn pthread_mutexattr_getprotocol( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_getpshared( attr: *const pthread_mutexattr_t, @@ -127,6 +140,7 @@ pub unsafe extern "C" fn pthread_mutexattr_getpshared( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_getrobust( attr: *const pthread_mutexattr_t, @@ -135,6 +149,7 @@ pub unsafe extern "C" fn pthread_mutexattr_getrobust( *robust = unsafe { &*attr.cast::() }.robust; 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_gettype( attr: *const pthread_mutexattr_t, @@ -143,12 +158,14 @@ pub unsafe extern "C" fn pthread_mutexattr_gettype( *ty = unsafe { &*attr.cast::() }.ty; 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int { unsafe { attr.cast::().write(RlctMutexAttr::default()) }; 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_setprioceiling( attr: *mut pthread_mutexattr_t, @@ -158,6 +175,7 @@ pub unsafe extern "C" fn pthread_mutexattr_setprioceiling( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_setprotocol( attr: *mut pthread_mutexattr_t, @@ -167,6 +185,7 @@ pub unsafe extern "C" fn pthread_mutexattr_setprotocol( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_setpshared( attr: *mut pthread_mutexattr_t, @@ -176,6 +195,7 @@ pub unsafe extern "C" fn pthread_mutexattr_setpshared( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_setrobust( attr: *mut pthread_mutexattr_t, @@ -184,6 +204,7 @@ pub unsafe extern "C" fn pthread_mutexattr_setrobust( unsafe { &mut *attr.cast::() }.robust = robust; 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_mutexattr_settype( attr: *mut pthread_mutexattr_t, diff --git a/src/header/pthread/once.rs b/src/header/pthread/once.rs index 76348bbcf6..b5d190fb98 100644 --- a/src/header/pthread/once.rs +++ b/src/header/pthread/once.rs @@ -2,6 +2,7 @@ use super::*; // PTHREAD_ONCE_INIT +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_once( once: *mut pthread_once_t, diff --git a/src/header/pthread/rwlock.rs b/src/header/pthread/rwlock.rs index 916579bd86..a9e53bba50 100644 --- a/src/header/pthread/rwlock.rs +++ b/src/header/pthread/rwlock.rs @@ -4,6 +4,7 @@ use crate::header::errno::{EBUSY, EINVAL}; use crate::{header::time::CLOCK_REALTIME, pthread::Pshared}; +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_init( rwlock: *mut pthread_rwlock_t, @@ -21,6 +22,7 @@ pub unsafe extern "C" fn pthread_rwlock_init( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_rdlock(rwlock: *mut pthread_rwlock_t) -> c_int { match unsafe { get(rwlock) }.acquire_read_lock(None) { @@ -28,6 +30,7 @@ pub unsafe extern "C" fn pthread_rwlock_rdlock(rwlock: *mut pthread_rwlock_t) -> Err(e) => e.0, } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_clockrdlock( rwlock: *mut pthread_rwlock_t, @@ -39,6 +42,7 @@ pub unsafe extern "C" fn pthread_rwlock_clockrdlock( Err(e) => e.0, } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_timedrdlock( rwlock: *mut pthread_rwlock_t, @@ -49,6 +53,7 @@ pub unsafe extern "C" fn pthread_rwlock_timedrdlock( Err(e) => e.0, } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_clockwrlock( rwlock: *mut pthread_rwlock_t, @@ -60,6 +65,7 @@ pub unsafe extern "C" fn pthread_rwlock_clockwrlock( Err(e) => e.0, } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_timedwrlock( rwlock: *mut pthread_rwlock_t, @@ -70,6 +76,7 @@ pub unsafe extern "C" fn pthread_rwlock_timedwrlock( Err(e) => e.0, } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_tryrdlock(rwlock: *mut pthread_rwlock_t) -> c_int { match unsafe { get(rwlock) }.try_acquire_read_lock() { @@ -77,6 +84,7 @@ pub unsafe extern "C" fn pthread_rwlock_tryrdlock(rwlock: *mut pthread_rwlock_t) Err(_) => EBUSY, } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_trywrlock(rwlock: *mut pthread_rwlock_t) -> c_int { match unsafe { get(rwlock) }.try_acquire_write_lock() { @@ -84,12 +92,14 @@ pub unsafe extern "C" fn pthread_rwlock_trywrlock(rwlock: *mut pthread_rwlock_t) Err(_) => EBUSY, } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_unlock(rwlock: *mut pthread_rwlock_t) -> c_int { unsafe { get(rwlock) }.unlock(); 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_wrlock(rwlock: *mut pthread_rwlock_t) -> c_int { match unsafe { get(rwlock) }.acquire_write_lock(None) { @@ -98,6 +108,7 @@ pub unsafe extern "C" fn pthread_rwlock_wrlock(rwlock: *mut pthread_rwlock_t) -> } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> c_int { unsafe { @@ -108,6 +119,7 @@ pub unsafe extern "C" fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlockattr_getpshared( attr: *const pthread_rwlockattr_t, @@ -118,6 +130,7 @@ pub unsafe extern "C" fn pthread_rwlockattr_getpshared( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlockattr_setpshared( attr: *mut pthread_rwlockattr_t, @@ -131,12 +144,14 @@ pub unsafe extern "C" fn pthread_rwlockattr_setpshared( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> c_int { unsafe { core::ptr::drop_in_place(attr) }; 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_rwlock_destroy(rwlock: *mut pthread_rwlock_t) -> c_int { unsafe { core::ptr::drop_in_place(rwlock) }; diff --git a/src/header/pthread/spin.rs b/src/header/pthread/spin.rs index 094a9ea31b..6000d6093f 100644 --- a/src/header/pthread/spin.rs +++ b/src/header/pthread/spin.rs @@ -7,6 +7,7 @@ use super::*; const UNLOCKED: c_int = 0; const LOCKED: c_int = 1; +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_spin_destroy(spinlock: *mut pthread_spinlock_t) -> c_int { let _spinlock = unsafe { &mut *spinlock.cast::() }; @@ -14,6 +15,7 @@ pub unsafe extern "C" fn pthread_spin_destroy(spinlock: *mut pthread_spinlock_t) // No-op 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_spin_init( spinlock: *mut pthread_spinlock_t, @@ -30,6 +32,7 @@ pub unsafe extern "C" fn pthread_spin_init( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_spin_lock(spinlock: *mut pthread_spinlock_t) -> c_int { let spinlock = unsafe { &*spinlock.cast::() }; @@ -48,6 +51,7 @@ pub unsafe extern "C" fn pthread_spin_lock(spinlock: *mut pthread_spinlock_t) -> 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_spin_trylock(spinlock: *mut pthread_spinlock_t) -> c_int { let spinlock = unsafe { &*spinlock.cast::() }; @@ -62,6 +66,7 @@ pub unsafe extern "C" fn pthread_spin_trylock(spinlock: *mut pthread_spinlock_t) 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_spin_unlock(spinlock: *mut pthread_spinlock_t) -> c_int { let spinlock = unsafe { &*spinlock.cast::() }; diff --git a/src/header/pthread/tls.rs b/src/header/pthread/tls.rs index 83f2826c46..b4c03d50e9 100644 --- a/src/header/pthread/tls.rs +++ b/src/header/pthread/tls.rs @@ -29,6 +29,7 @@ static VALUES: RefCell> = RefCell::new(BTreeMap: static KEYS: Mutex> = Mutex::new(BTreeMap::new()); static NEXTKEY: AtomicUsize = AtomicUsize::new(1); +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_getspecific(key: pthread_key_t) -> *mut c_void { // According to POSIX (issue 8): Calling [`pthread_getspecific`] with a key @@ -44,6 +45,7 @@ pub unsafe extern "C" fn pthread_getspecific(key: pthread_key_t) -> *mut c_void .unwrap_or(ptr::null_mut()) } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_setspecific(key: pthread_key_t, value: *const c_void) -> c_int { if !KEYS.lock().contains_key(&key) { @@ -63,6 +65,7 @@ pub unsafe extern "C" fn pthread_setspecific(key: pthread_key_t, value: *const c 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_key_create( key_ptr: *mut pthread_key_t, @@ -80,6 +83,7 @@ pub unsafe extern "C" fn pthread_key_create( 0 } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn pthread_key_delete(key: pthread_key_t) -> c_int { if KEYS.lock().remove(&key).is_none() || VALUES.borrow_mut().remove(&key).is_none() {