OpenBSD manual page server

Manual Page Search Parameters

PTHREAD_SPIN_LOCK(3) Library Functions Manual PTHREAD_SPIN_LOCK(3)

pthread_spin_lock, pthread_spin_trylocklock a spinlock object

#include <pthread.h>

int
pthread_spin_lock(pthread_spinlock_t *lock);

int
pthread_spin_trylock(pthread_spinlock_t *lock);

The () function locks the spinlock referenced by lock. The calling thread will acquire the lock if it's not owned by another thread. Otherwise it will spin until the lock becomes available.

The () function will acquire the lock if the lock is not owned by another thread. Otherwise it will fail.

If successful, pthread_spin_lock() and pthread_spin_trylock() return zero; otherwise an error number is returned to indicate the error.

pthread_spin_lock() will fail if:

[]
The value specified by lock is invalid.
[]
A deadlock condition was detected.

pthread_spin_trylock() will fail if:

[]
The value specified by lock is invalid.
[]
The lock is still in use.
[]
A deadlock condition was detected.

pthread_spin_init(3), pthread_spin_unlock(3)

pthread_spin_lock() and pthread_spin_trylock() conform to IEEE Std 1003.1-2008 (“POSIX.1”).

April 6, 2020 OpenBSD-6.8