NAME
pthread_spin_init,
    pthread_spin_destroy —
    initialize and destroy a spinlock
    object
SYNOPSIS
#include
    <pthread.h>
int
  
  pthread_spin_init(pthread_spinlock_t
    *lock, int
    pshared);
int
  
  pthread_spin_destroy(pthread_spinlock_t
    *lock);
DESCRIPTION
The
    pthread_spin_init()
    function creates a new spinlock object, with sharing attributes specified by
    pshared.
The
    pthread_spin_destroy()
    function frees the resources allocated for the
  lock.
RETURN VALUES
If successful, pthread_spin_init() and
    pthread_spin_destroy() return zero; otherwise an
    error number is returned to indicate the error.
ERRORS
pthread_spin_init() will fail if:
- [EINVAL]
- The value specified by lock is invalid.
- [ENOMEM]
- The process cannot allocate enough memory to create another spinlock object.
- [ENOTSUP]
- The shared attributes specified by pshared are not supported by the current implementation.
pthread_spin_destroy() will fail if:
- [EINVAL]
- The value specified by lock is invalid.
- [EBUSY]
- The lock is still in use.
SEE ALSO
STANDARDS
pthread_spin_init() and
    pthread_spin_destroy() conform to
    IEEE Std 1003.1-2008 (“POSIX.1”).
BUGS
Currently only PTHREAD_PROCESS_PRIVATE
    spinlocks are supported and the pshared attribute is always set that way.
    Any attempts to initialize it to a different value will trigger
    ENOTSUP.