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.
ETIMEDOUT
Description:The lock could not be acquired before the specified timeout expired.
EAGAIN
Description:The read lock could not be acquired because the maximum number of read locks for lock would be exceeded.
EDEADLK
Description:The calling thread already holds the rwlock.
EINVAL
Description: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.