#include <pthread.h> int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock);
pthread_rwlock_trywrlock(3THR) applies a write lock like pthread_rwlock_wrlock(), with the exception that the function fails if any thread currently holds rwlock (for reading or writing). (For Solaris threads, see rw_trywrlock(3THR).)
Results are undefined if pthread_rwlock_trywrlock() is called with an uninitialized read-write lock.
If a signal is delivered to a thread waiting for a read-write lock for writing, on return from the signal handler the thread resumes waiting for the read-write lock for writing as if it was not interrupted.
If successful, pthread_rwlock_trywrlock() returns zero if the lock for writing on the read-write lock object referenced by rwlock is acquired. Otherwise, an error number is returned to indicate the error.