|
NAMEpthread_rwlock_rdlock ,
pthread_rwlock_tryrdlock —
acquire a read/write lock for reading
LIBRARYPOSIX Threads Library (libpthread, -lpthread)SYNOPSIS#include <pthread.h>
int
int
DESCRIPTIONThepthread_rwlock_rdlock () function acquires a read
lock on lock provided that lock is
not presently held for writing and no writer threads are presently blocked on
the lock. If the read lock cannot be immediately acquired, the calling thread
blocks until it can acquire the lock.
The A thread may hold multiple concurrent read locks. If so,
The results of acquiring a read lock while the calling thread holds a write lock are undefined. IMPLEMENTATION NOTESTo prevent writer starvation, writers are favored over readers.RETURN VALUESIf successful, thepthread_rwlock_rdlock () and
pthread_rwlock_tryrdlock () functions will return zero.
Otherwise an error number will be returned to indicate the error.
ERRORSThepthread_rwlock_tryrdlock () function will fail if:
The
SEE ALSOpthread_rwlock_init(3), pthread_rwlock_trywrlock(3), pthread_rwlock_unlock(3), pthread_rwlock_wrlock(3)STANDARDSThepthread_rwlock_rdlock () and
pthread_rwlock_tryrdlock () functions are expected to
conform to Version 2 of the Single UNIX Specification
(“SUSv2”).
HISTORYThepthread_rwlock_rdlock () function first appeared in
FreeBSD 3.0.
Visit the GSP FreeBSD Man Page Interface. |