pthread_rwlock_unlock() — Unlock a read or write lock object
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
z/OS UNIX |
both | POSIX(ON) |
Format
#define _OPEN_THREADS
#include <pthread.h>
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
#define _UNIX03_THREADS
#include <pthread.h>
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
General description
The pthread_rwlock_unlock() function releases a read or write lock object. If one or more threads are waiting to lock the rwlock, pthread_rwlock_unlock() causes one or more of these threads to return from the pthread_rwlock_rdlock() or the pthread_rwlock_wrlock() call with the read or write lock object acquired. If there are multiple threads blocked on rwlock for both read locks and write locks, z/OS® UNIX will give the read or write lock to the next waiting call whether it is a read or a write request even when there is a writer blocked waiting for the lock. If no threads are waiting for the rwlock, the rwlock unlocks with no current owner.
Returned value
If successful, pthread_rwlock_unlock() returns 0.
- Error Code
- Description
- EINVAL
- The value specified for rwlock is not valid.
- ENOMEM
- There is not enough memory during the unlock process. This errno will only occur in the private path.
- EPERM
- The current thread does not own the read_write lock object.
Special behavior for Single UNIX Specification, Version 3: If unsuccessful, pthread_rwlock_unlock() returns an error number to indicate the error.
Related information
- pthread.h
- pthread_rwlock_destroy() — Destroy a read or write lock object
- pthread_rwlock_init() — Initialize a read or write lock object
- pthread_rwlock_rdlock() — Wait for a lock on a read or write lock object
- pthread_rwlock_tryrdlock() — Attempt to lock a read or write lock object for reading
- pthread_rwlock_trywrlock() — Attempt to lock a read or write lock object for writing
- pthread_rwlock_wrlock() — Wait for a lock on a read or write lock object for writing