pthread_spin_lock(3)
Canonical URL: /pthread_spin_lock.3/
NAME
pthread_spin_lock,
pthread_spin_trylock —
lock a spinlock object
SYNOPSIS
/* -lpthread */
#include <pthread.h>
int
pthread_spin_lock(pthread_spinlock_t
*lock);
int
pthread_spin_trylock(pthread_spinlock_t
*lock);
DESCRIPTION
The
pthread_spin_lock()
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
pthread_spin_trylock()
function will acquire the lock if the lock is not
owned by another thread. Otherwise it will fail.
RETURN VALUES
If successful, pthread_spin_lock() and
pthread_spin_trylock() return zero; otherwise an
error number is returned to indicate the error.
ERRORS
pthread_spin_lock() will fail if:
pthread_spin_trylock() will fail if:
SEE ALSO
STANDARDS
pthread_spin_lock() and
pthread_spin_trylock() conform to
IEEE Std 1003.1-2008 (“POSIX.1”).
Need conceptual guidance? Continue in the OpenBSD Handbook.