| Main index | Section 3 | Options |
#include <pthread.h>
The pthread_rwlock_tryrdlock() function performs the same action, but does not block if the lock cannot be immediately obtained (i.e., the lock is held for writing or there are waiting writers).
A thread may hold multiple concurrent read locks. If so, pthread_rwlock_unlock() must be called once for each lock obtained.
The results of acquiring a read lock while the calling thread holds a write lock are undefined.
| [EBUSY] | |
| The lock could not be acquired because a writer holds the lock or was blocked on it. | |
The pthread_rwlock_rdlock() and pthread_rwlock_tryrdlock() functions may fail if:
| [EAGAIN] | |
| The lock could not be acquired because the maximum number of read locks against lock has been exceeded. | |
| [EDEADLK] | |
| The current thread already owns lock for writing. | |
| [EINVAL] | |
| The value specified by lock is invalid. | |
| [ENOMEM] | |
| Insufficient memory exists to initialize the lock (applies to statically initialized locks only). | |
| PTHREAD_RWLOCK_RDLOCK (3) | August 4, 1998 |
| Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | Our grievance is not just against Unix itself, but against the cult of Unix zealots who defend and nurture it. They take the heat, disease, and pestilence as givens, and, as ancient shamans did, display their wounds, some self-inflicted, as proof of their power and wizardry. We aim, through bluntness and humor, to show them that they pray to a tin god, and that science, not religion, is the path to useful and friendly technology. | ” |
| — The Unix Haters' handbook | ||