SYNOPSIS
#include <pthread.h>
int pthread_spin_destroy(pthread_spinlock_t *lock);
int pthread_spin_init(pthread_spinlock_t *lock, int pshared);
DESCRIPTION
The
The
When the value of pshared is PTHREAD_PROCESS_SHARED, the spin lock can be operated upon by any thread that has access to the memory where the spin lock is allocated, even if it is allocated in memory that is shared by multiple processes.
When the value of pshared is PTHREAD_PROCESS_PRIVATE, the spin lock can only be operated upon by threads created within the same process as the thread that initialized the spin lock.
Only the object referenced by lock may be used for performing synchronization.
Referring to copies of lock in calls to the
PARAMETERS
- lock
-
Points to a spin lock.
- pshared
-
Specifies whether the spin lock can be operated upon by any thread with access to the spin lock's memory or just by threads by threads created by the initializing thread.
RETURN VALUES
On success, these functions return 0. On failure, they return one of the following error values:
-
EAGAIN
- EBUSY
-
An attempt to initialize or destroy a spin lock occurred while it was in use (for example, while being used in a
pthread_spin_lock() call) by another thread. - EINVAL
-
The value specified by lock is invalid.
- ENOMEM
-
Insufficient memory exists to initialize the lock.
The system lacks the necessary resources to initialize another spin lock.
CONFORMANCE
UNIX 03.
MULTITHREAD SAFETY LEVEL
MT-Safe.
PORTING ISSUES
None.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
pthread_spin_lock() ,pthread_spin_unlock()
PTC MKS Toolkit 10.5 Documentation Build 40.