Index of Section 2 Manual Pages
| Interix / SUA | pthread_spin_trylock.2 | Interix / SUA |
pthread_spin_trylock(2) pthread_spin_trylock(2)
pthread_spin_lock()
NAME
pthread_spin_lock(), pthread_spin_trylock() - lock a spin lock
SYNOPSIS
#include
int pthread_spin_lock(pthread_spinlock_t *lock);
int pthread_spin_trylock(pthread_spinlock_t *lock);
DESCRIPTION
The pthread_spin_lock(2) function waits until the lock referenced by the
lock argument is available and then locks the spin lock and returns. Until
the spin lock becomes available, the calling thread is blocked ("spins").
The pthread_spin_trylock(2) function locks the spin lock referenced by the
lock argument and returns if the spin lock is available. If the spin lock
is not available, pthread_spin_trylock immediately returns an error.
RETURN VALUES
On success, both functions return 0; otherwise, an error code is returned.
ERRORS
Both functions can fail for the following reason:
[EINVAL]
The lock argument does not refer to a valid lock object.
The pthread_spin_lock() function can fail for the following reason:
[EDEADLK]
The calling thread already owns the spin lock.
The pthread_spin_trylock() function can fail for the following reasons:
[EBUSY]
The spin lock is already locked.
Neither function returns [EINTR].
SEE ALSO
pthread_spin_destroy(2)
pthread_spin_unlock(2)
USAGE NOTES
All of these functions are thread safe.
None of these functions are async-signal safe.