Avoiding a Block
To avoid blocking during the acquisition of a mutex that is already owned by another thread, use the tryAcquire() method. This function returns false if the mutex is already owned by another thread and returns true if the mutex has been successfully acquired.
The interactions between these functions are illustrated using the interaction diagram shown in Figure 24:
Figure 24 – RWMutexLock interactions