release a read-write lock
cc [options] -Kthread file
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
pthread_rwlock_unlock releases a reader-writer lock
previously acquired by pthread_rwlock_rdlock,
The behavior differs according to whether the caller
is a reader or a writer:
When a writer calls pthread_rwlock_unlock,
the lock is unlocked.
When a reader calls pthread_rwlock_unlock,
the reader count is decremented.
If the reader count is zero,
pthread_rwlock_unlock unlocks the lock,
the lock is not unlocked.
When pthread_rwlock_unlock unlocks the lock,
the first waiter (reader or writer) is activated.
If the thread activated is a reader,
all subsequent readers are activated
(up to the next writer or end of queue).
If the thread activated is a writer,
no other threads are activated.
If pthread_rwlock_unlock releases the
last read lock for this read-write lock object,
the read-write lock object will be put in
the unlocked state with no owners.
If pthread_rwlock_unlock is called to
release a write lock for this read-write lock object,
the read-write lock object will be put
in the unlocked state with no owners.
If the call to pthread_rwlock_unlock
results in the read-write lock object becoming
unlocked and there are multiple threads waiting
to acquire the read-write lock object for writing,
the scheduling policy is used to determine which
thread acquires the read-write lock object for writing.
If there are multiple threads waiting to acquire
the read-write lock object for reading,
threads are awakened in the order in which
they arrived (that is, FIFO order).
Results are undefined if pthread_rwlock_unlock
is called with an uninitialized or unlocked read-write lock.
parameter is a
pointer to the lock to be released.
pthread_rwlock_unlock returns zero on success.
Otherwise, an error number is returned.
returns the following values
if the corresponding conditions are detected:
Invalid argument specified.
The value specified by rwlock
does not refer to an initialized read-write lock object.
rwlock not locked.
The Single UNIX Specification, Version 2; The Open Group.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004