pthread_rwlock_destroy() — Destroy a read or write lock object
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
z/OS® UNIX
Single UNIX Specification, Version 3 |
both | POSIX(ON)
OS/390® V2R7 |
Format
#define _OPEN_THREADS
#include <pthread.h>
int pthread_rwlock_destroy(pthread_rwlock_t *rwlock);
SUSV3:
#define _UNIX03_THREADS
#include <pthread.h>
int pthread_rwlock_destroy(pthread_rwlock_t *rwlock);
General description
The pthread_rwlock_destroy() function deletes a read or write lock object, which is identified by rwlock and releases any resources used by this read or write lock object. Read/write locks are used to protect shared resources.
Note: rwlock is set
to an invalid value by pthread_rwlock_destroy() but can be reinitialized
using pthread_rwlock_init().
Returned value
If successful, pthread_rwlock_destroy() returns 0.
If unsuccessful, pthread_rwlock_destroy() returns -1 and sets errno to one of the following values:
- Error Code
- Description
- EBUSY
- An attempt was made to destroy the object referenced by rwlock while it is locked or referenced as part of a wait on a condition variable.
- EINVAL
- The value specified by rwlock is not valid.
Special behavior for Single UNIX Specification, Version 3: If unsuccessful, pthread_rwlock_destroy() returns an error number to indicate the error.
Related information
- pthread.h — Thread interfaces
- 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_unlock() — Unlock a read or write lock object
- pthread_rwlock_wrlock() — Wait for a lock on a read or write lock object for writing