May 26, 2008 PTHREAD_SPIN_UNLOCK 3

### NAME

pthread_spin_unlock - release a spin lock

### LIBRARY

POSIX Thread Library (libpthread, -lpthread)

### SYNOPSIS

```int` pthread_spin_unlock(```pthread_spinlock_t *lock`)

### DESCRIPTION

The pthread_spin_unlock(``) function is used to release the read/write lock previously obtained by pthread_spin_lock(``) or pthread_spin_trylock(``).

### RETURN VALUES

If successful, the pthread_spin_unlock(``) function will return zero. Otherwise an error number will be returned to indicate the error.

The results are undefined if ```lock` is not held by the calling thread.

### ERRORS

The pthread_spin_unlock(``) function may fail if:

[```EINVAL`]
  The value specified by ```lock` is invalid.

### SEE ALSO

pthread_spin_destroy(3), pthread_spin_init(3), pthread_spin_lock(3), pthread_spin_trylock(3)

### STANDARDS

pthread_rwlock_unlock(``) conforms to IEEE Std 1003.1-2001 (``POSIX.1'') .

### CAVEATS

Applications using spinlocks are vulnerable to the effects of priority inversion. Applications using real-time threads (```SCHED_FIFO`,`SCHED_RR`) should not use these interfaces. Outside carefully controlled environments, priority inversion with spinlocks can lead to system deadlock. Mutexes are preferable in nearly every possible use case.