May 26, 2008 PTHREAD_SPIN_DESTROY 3

### NAME

pthread_spin_destroy - destroy a spin lock

### LIBRARY

POSIX Thread Library (libpthread, -lpthread)

### SYNOPSIS

```int` pthread_spin_destroy(```pthread_spinlock_t *lock`)

### DESCRIPTION

The pthread_spin_destroy(``) function is used to destroy a spin lock previously created with pthread_spin_init(``).

### RETURN VALUES

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

### ERRORS

The pthread_spin_destroy(``) function may fail if:

[```EBUSY`]
  The system has detected an attempt to destroy the object referenced by ```lock` while it is locked.

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

### SEE ALSO

pthread_spin_init(3), pthread_spin_lock(3), pthread_spin_trylock(3), pthread_spin_unlock(3)

### STANDARDS

pthread_spin_destroy(``) 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.