If successful, returns 0 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.
The lock could not be acquired before the specified timeout expired.
The read lock could not be acquired because the maximum number of read locks for lock would be exceeded.
The calling thread already holds the rwlock.
The value specified by rwlock does not refer to an initialized read-write lock object, or the timeout nanosecond value is less than zero or greater than or equal to 1,000 million.