pthread_spin_unlock Subroutine

Purpose

Unlocks a spin lock object.

Syntax

#include <pthread.h>

int pthread_spin_unlock(pthread_spinlock_t *lock);

Description

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.

Return Values

Upon successful completion, the pthread_spin_unlock subroutine returns zero; otherwise, an error number is returned to indicate the error.

Error Codes

Item Description
EINVAL An invalid argument was specified.
EPERM The calling thread does not hold the lock.