Skip to main content

pthread_spin_init

Function pthread_spin_init 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pthread_spin_init( lock: *mut pthread_spinlock_t, _pshared: c_int, ) -> c_int
Expand description

See https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_spin_init.html.

Allocates any resources required to use the spin lock referenced to by lock and initializes the lock to an unlocked state.

Upon success, returns 0. Upon failure, an error number is returned.

§Implementation

Cannot fail on the Rust side so no error number is ever returned.

§Safety

It is undefined behaviour for any of the following:

  • lock has already been initialized.
  • lock has been used before being initialized by this function.