#include <pthread.h> int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);Service Program Name: QP0WPTHR
The pthread_rwlock_unlock() function unlocks a shared read or exclusive write lock held by the calling thread.
A thread should call pthread_rwlock_unlock() once for each time that the thread successfully called pthread_rwlock_rdlock(), pthread_rwlock_tryrdlock(), pthread_rwlock_trywrlock(), pthread_rwlock_timedrdlock_np(), or pthread_rwlock_timedwrlock_np() to acquire a shared read or exclusive write lock. For example, if a thread holds 4 shared read locks on a read/write lock object, the thread must call pthread_rwlock_unlock() 4 times before the read/write lock becomes completely unlocked.
If a thread holds both shared read and exclusive write locks for the specified read/write lock object, the exclusive write locks are unlocked first. If more than one outstanding exclusive write lock was held by the thread, a matching number of successful calls to pthread_rwlock_unlock() must be done before all write locks are unlocked. When all write locks are unlocked, subsequent calls to pthread_rwlock_unlock() unlock the shared read locks.
For successful completion, either a shared read or exclusive write lock must be held on the read/write lock before you call pthread_rwlock_unlock().
If pthread_rwlock_unlock() was not successful, the error condition returned usually indicates one of the following errors. Under some conditions, the value returned could indicate an error other than those listed here.
The value specified for the argument is not correct.
A shared read or exclusive write lock was not held by the calling thread and could not be unlocked.
See Code disclaimer information for information pertaining to code examples.
See any of the following examples:
Top | Pthread APIs | APIs by category |