PTHREAD_SPIN_INIT(3)

NAME
pthread_spin_init - initialize a spin lock

LIBRARY
libpthread

SYNOPSIS
#include <pthread.h>
int
pthread_spin_init(pthread_spinlock_t *lock, int pshared);

DESCRIPTION
The pthread_spin_init() function is used to initialize a spinlock. The pshared parameter is currently unused and all spinlocks exhibit the PTHREAD_PROCESS_SHARED property.

The results of calling pthread_spin_init() with an already initialized lock are undefined.

RETURN VALUES
If successful, the pthread_spin_init() function will return zero. Otherwise an error number will be returned to indicate the error.

ERRORS
The pthread_spin_init() function shall fail if:

[ENOMEM]
    Insufficient memory exists to initialize the lock.

The pthread_spin_init() function may fail if:

[EINVAL]
    The lock parameter was NULL or the pshared parameter was neither PTHREAD_PROCESS_SHARED nor PTHREAD_PROCESS_PRIVATE.

SEE ALSO
pthread_spin_destroy(3), pthread_spin_lock(3), pthread_spin_trylock(3), pthread_spin_unlock(3)

STANDARDS
pthread_spin_init() conforms to p1003.1-2001.