Unlocks a spin lock object.
#include <pthread.h>
int pthread_spin_unlock(pthread_spinlock_t *lock);
The pthread_spin_unlock subroutine releases the spin lock referenced by the lock parameter which was locked using the pthread_spin_lock subroutine or the pthread_spin_trylock subroutine. The results are undefined if the lock is not held by the calling thread. If there are threads spinning on the lock when the pthread_spin_unlock subroutine is called, the lock becomes available and an unspecified spinning thread shall acquire the lock.
The results are undefined if this subroutine is called with an uninitialized thread spin lock.
Upon successful completion, the pthread_spin_unlock subroutine returns zero; otherwise, an error number is returned to indicate the error.
Item | Description |
---|---|
EINVAL | An invalid argument was specified. |
EPERM | The calling thread does not hold the lock. |