|
Syntax #include <pthread.h> int pthread_rwlock_destroy(pthread_rwlock_t *rwlock); Threadsafe: Yes Signal Safe: Yes |
The pthread_rwlock_destroy() function destroys the named read/write lock. The destroyed read/write lock can no longer be used.
If pthread_rwlock_destroy() is called on a read/write lock on a mutex that is locked by another thread for either reading or writing, the request will fail with an EBUSY error.
If pthread_rwlock_destroy() is used by a thread when it owns the read/write lock, and other threads ware waiting for the read/write lock to become available (with calls to pthread_rwlock_rdlock(), pthread_rwlock_wrlock(), pthread_rwlock_timedrdlock_np() or pthread_rwlock_timedwrlock_np() APIs), the destruction of the read/write lock will occur safely, and the waiting threads will wake up with the EDESTROYED error. Threads calling pthread_rwlock_tryrdlock() or pthread_rwlock_trywrlock() will return with either the EBUSY or EINVAL error depending on when they called those functions.
Once a read/write lock is created, it cannot be validly copied or moved to a new location.
None.
If pthread_rwlock_destroy() 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.
See the pthread_rwlock_init() example