f_pthread_rwlock_trywrlock(rwlock)

Purpose

This function applies a write lock like the f_pthread_rwlock_wrlock function with the exception that the function fails if any thread currently holds rwlock (for reading or writing). In that case, the function returns EBUSY. The calling thread can check the return code to take further actions.

Class

Function

Argument Type and Attributes

rwlock
TYPE(f_pthread_rwlock_t), INTENT(INOUT)

Result Type and Attributes

INTEGER(4)

Result Value

This function returns zero if the lock for writing on the read-write lock object specified by rwlock is acquired. Otherwise, the following error will be returned:

EBUSY
The read-write lock could not be acquired for writing because it is already locked for reading or writing.
IBM Copyright 2003