pthread_rwlock_unlock()

unlock a read-write lock object 

Advanced Realtime Threads


SYNOPSIS

#include <pthread.h>

int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);


DESCRIPTION

The pthread_rwlock_unlock() function releases a lock held on the read-write lock object pointed to by the rwlock argument.

When using pthread_rwlock_unlock() to realease a read lock from a read-write lock object that has other read locks on it, the object remains read locked. When this function releases the final read lock for this object, rwlock is put in the unlocked state with no owners.

When using pthread_rwlock_unlock() to release a write lock for rwlock, the object is put in the unlocked state.

When the lock become becomes available and there are threads blocked on it, write locks take precedence over read locks.


PARAMETERS

rwlock 

Points to a read-write lock object.


RETURN VALUES

On success, the pthread_rwlock_unlock() function returns zero. On failure, it returns one of the following error numbers:

EINVAL 

rwlock does not point to an initialized read-write lock object.

EPERM 

The current thread does not hold a lock on the read-write lock object.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

On the NuTCRACKER Platform, waiting writers of any priority acquire the lock before waiting readers. A call to the Win32 SetEvent() function determines which thread wakes up and Win32 will likely pick higher priority writers first and then higher priority writers if there are no waiting writers. For equal priority threads, write locks take precedence over read locks.


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_destroy(), pthread_rwlock_rdlock(), pthread_rwlock_timedrdlock(), pthread_rwlock_timedwrlock(), pthread_rwlock_tryrdlock(), pthread_rwlock_trywrlock(), pthread_rwlock_wrlock()


PTC MKS Toolkit 10.5 Documentation Build 40.