SYNOPSIS
#include <pthread.h>
int pthread_rwlock_destroy(pthread_rwlock_t *rwlock);
int pthread_rwlock_init(pthread_rwlock_t *restrict rwlock, const pthread_rwlockattr_t *restrict attr);
DESCRIPTION
The
The
A read-write lock can be statically initialized by assigning PTHREAD_RWLOCK_INITIALIZER in its definition, as follows:
pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
A read-write lock must be initialized (either
by calling
The
If the
Only the object referenced by rwlock may be used for performing
synchronization. The result of referring to copies of that object in calls to
is undefined.
You can only use rwlock itself to perform synchronization.
Referring to copies of rwlock in calls to the
PARAMETERS
- attr
-
Points to an object specifying the attributes to assign to the read-write lock being initialized.
- rwlock
-
Points to a read-write lock to be initialized or destroyed.
RETURN VALUES
On success, the
- EAGAIN
-
Insufficient resources (other than memory) exist to initialize another read-write lock.
- EBUSY
-
You tried to destroy the object pointed to by rwlock while it was locked or held by another thread.
- EINVAL
-
The rwlock or attr arguments specify an invalid value. For example, this may occur when you try to destroy an uninitialized read-write lock with
pthread_rwlock_destroy() , try to initialize an already initialized read-write lock withpthread_rwlock_init() , or try to use any read-lock lock without first initializing it. - ENOMEM
-
Insufficient memory exists to initialize the read-write lock.
- EPERM
-
The caller lacks the required privilege to perform the operation.
CONFORMANCE
UNIX 03.
MULTITHREAD SAFETY LEVEL
MT-Safe.
PORTING ISSUES
None.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
pthread_rwlock_rdlock() ,pthread_rwlock_timedrdlock() ,pthread_rwlock_timedwrlock() ,pthread_rwlock_tryrdlock() ,pthread_rwlock_trywrlock() ,pthread_rwlock_unlock() ,pthread_rwlock_wrlock()
PTC MKS Toolkit 10.5 Documentation Build 40.