Index of Section 2 Manual Pages
| Interix / SUA | pthread_spin_destroy.2 | Interix / SUA |
pthread_spin_destroy(2) pthread_spin_destroy(2)
pthread_spin_destroy()
NAME
pthread_spin_destroy(), pthread_spin_init() - initialize or destroy a spin
lock
SYNOPSIS
#include
int pthread_spin_destroy(pthread_spinlock_t *lock);
int pthread_spin_init(pthread_spinlock_t *lock, int pshared);
DESCRIPTION
The pthread_spin_init(2) function initializes the spin lock referenced by
the lock argument using the process-shared attribute specified by pshared.
When the process-shared attribute is set to PTHREAD_PROCESS_SHARED, the
spin lock can be acted upon by any thread that can access the memory where
the spin lock is stored, even if the spin lock is allocated in memory
shared by multiple processes. When the process-shared attribute is set to
PTHREAD_PROCESS_PRIVATE (the default), the spin lock can be acted upon
only by threads that have been created in the same process as the thread
that initialized the spin lock.
The pthread_spin_destroy(2) function destroys the spin lock referenced by
the lock argument.
RETURN VALUES
On success, the functions return 0; otherwise, an error code is returned.
ERRORS
Both functions can fail for the following reasons:
[EBUSY]
The specified spin lock is in use by another thread.
[EINVAL]
The lock argument is invalid.
The pthread_spin_init() function can fail for the following reasons:
[EAGAIN]
A required system resource, other than memory, has been exhausted
[ENOMEM]
Not enough free memory exists to initialize the spin lock.
Neither function returns [EINTR].
SEE ALSO
pthread_spin_lock(2)
pthread_spin_unlock(2)
USAGE NOTES
All of these functions are thread safe.
None of these functions are async-signal safe.