| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 3: Basic Library Functions Oracle Solaris 11 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- destroy or initialize a spin lock object
cc-mt [flag... ]file... [library... ]#include <pthread.h>intpthread_spin_destroy(pthread_spinlock_t *lock);
intpthread_spin_init(pthread_spinlock_t *lock,intpshared);
Thepthread_spin_destroy() function destroys the spin lock referenced bylock and releaseany resources used by the lock. The effect of subsequent use ofthe lock is undefined until the lock is reinitialized by another calltopthread_spin_init(). The results are undefined ifpthread_spin_destroy() is called when athread holds the lock, or if this function is called with anuninitialized thread spin lock.
Thepthread_spin_init() function allocates any resources required to use the spin lockreferenced bylock and initialize the lock to an unlocked state.
If the Thread Process-Shared Synchronization option is supported and the value ofpshared isPTHREAD_PROCESS_SHARED, the spin lock can be operated upon by anythread that has access to the memory where the spin lock isallocated, even if it is allocated in memory that is shared by multipleprocesses.
If the Thread Process-Shared Synchronization option is supported and the value ofpshared isPTHREAD_PROCESS_PRIVATE, or if the option is not supported, the spinlock can only be operated upon by threads created within the sameprocess as the thread that initialized the spin lock. If threads of differingprocesses attempt to operate on such a spin lock, the behavior isundefined.
The results are undefined ifpthread_spin_init() is called specifying an already initializedspin lock. The results are undefined if a spin lock is usedwithout first being initialized.
If thepthread_spin_init() function fails, the lock is not initialized and thecontents oflock are undefined.
Only the object referenced bylock can be used for performing synchronization.
The result of referring to copies of that object in calls topthread_spin_destroy(),pthread_spin_lock(3C),pthread_spin_trylock(3C), orpthread_spin_unlock(3C) is undefined.
Upon successful completion, these functions returns 0. Otherwise, an error number isreturned to indicate the error.
Thepthread_spin_init() function will fail if:
The system lacks the necessary resources to initialize another spin lock.
These functions may fail if:
The system has detected an attempt to initialize or destroy a spin lock while it is in use (for example, while being used in apthread_spin_lock() call) by another thread.
The value specified bylock is invalid.
Seeattributes(5) for descriptions of the following attributes:
|
pthread_spin_lock(3C),pthread_spin_unlock(3C),attributes(5),standards(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |