Standards / Extensions | C or C++ | Dependencies |
---|---|---|
z/OS UNIX |
both | POSIX(ON) |
#define _OPEN_THREADS
#include <pthread.h>
int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock);
#define _UNIX03_THREADS
#include <pthread.h>
int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock);
The pthread_rwlock_wrlock() function applies a write lock to the read or write lock referenced by rwlock. The calling thread acquires the write lock if no other thread (reader or writer) holds the read or write lock rwlock. Otherwise, the thread blocks (that is, does not return from the pthread_rwlock_wrlock() call) until it can acquire the lock. In z/OS® UNIX the calling thread does not acquire the lock when a writer does not hold the lock and there are writers waiting for the lock. It will block and wait until there are no writers holding or waiting for the read or write lock. If the thread already holds read or write lock for either read or write then a deadlock errno will be returned.
If successful, pthread_rwlock_wrlock() returns 0.
Special behavior for Single UNIX Specification, Version 3:
If unsuccessful, pthread_rwlock_wrlock() returns an error number to indicate the error.