pthread_rwlock_destroy()--Destroy Read/Write Lock


  Syntax:
 #include <pthread.h>
 int pthread_rwlock_destroy(pthread_rwlock_t *rwlock);  
  Service Program Name: QP0WPTHR

  Default Public Authority: *USE

  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 fails with an EBUSY error.

If pthread_rwlock_destroy() is used by a thread when it owns the read/write lock, and other threads are 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 read/write lock is destroyed safely, and the waiting threads wake up with the EDESTROYED error. Threads calling pthread_rwlock_tryrdlock() or pthread_rwlock_trywrlock() 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.


Authorities and Locks

None.


Parameters

rwlock
(Input) Address of the read/write lock to be destroyed

Return Value

0
pthread_rwlock_destroy() was successful.
value
pthread_rwlock_destroy() was not successful. value is set to indicate the error condition.

Error Conditions

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.

[EINVAL]

The value specified for the argument is not correct.


Related Information


Example

See Code disclaimer information for information pertaining to code examples.

See the pthread_rwlock_init() example.


API introduced: V4R3
Top | Pthread APIs | APIs by category