pthread_spin_init(3) - NetBSD Manual Pages

PTHREAD_SPIN_INIT(3)    NetBSD Library Functions Manual   PTHREAD_SPIN_INIT(3)


NAME
pthread_spin_init -- initialize a spin lock
LIBRARY
POSIX Threads Library (libpthread, -lpthread)
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. Other- wise 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 IEEE Std 1003.1-2001 (``POSIX.1'').
CAVEATS
Applications using spinlocks are vulnerable to the effects of priority inversion. Applications using real-time threads (SCHED_FIFO, SCHED_RR) should not use these interfaces. Outside carefully controlled environ- ments, priority inversion with spinlocks can lead to system deadlock. Mutexes are preferable in nearly every possible use case. NetBSD 5.1 May 26, 2008 NetBSD 5.1

Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.