pthread_rwlock_init(3P) pthread_rwlock_init(3P)
pthread_rwlock_init, pthread_rwlock_destroy - initialize/destroy a readwrite
lock object
#include <pthread.h>
int pthread_rwlock_init(pthread_rwlock_t *rwlock,
pthread_rwlockattr_t *attr);
int pthread_rwlock_destroy(pthread_rwlock_t *rwlock);
Read-write locks may be initialized either dynamically, by calling
pthread_rwlock_init(), or statically, via the macro
PTHREAD_RWLOCK_INITIALIZER.
The personality of the read-write lock is determined by the attribute
structure attr passed with the call to pthread_rwlock_init(). These
attributes are set by calls to pthread_rwlockattr_init() and the various
pthread read-write lock attribute functions. If attr is null (or the
read-write lock is statically initialized), the default attributes are
used.
The routine pthread_rwlock_destroy() uninitializes the read-write lock
object referenced by rwlock.
The read-write lock object functions return zero if successful;
otherwise, an error number is returned.
pthread_rwlock_destroy() can return the following error:
[EBUSY] The read-write lock is currently held by any thread.
pthread_rwlock_rdlock(3P), pthread_rwlock_wrlock(3P),
pthread_rwlock_unlock(3P), pthread_rwlockattr_init(3P),
pthread_rwlockattr_setpshared(3P).
PPPPaaaaggggeeee 1111 [ Back ]
|