public class ReentrantMutex
extends java.lang.Object
Constructor and Description |
---|
ReentrantMutex() |
Modifier and Type | Method and Description |
---|---|
void |
lock()
Lock the mutex, blocking until it can be locked.
|
boolean |
tryLock()
Return
true (and lock the mutex) if the mutex can be locked without blocking, otherwise false . |
void |
unlock()
Unlock the mutex, which must have previously been locked by the current thread using
ReentrantMutex.lock or ReentrantMutex.tryLock . |
public void lock()
Lock the mutex, blocking until it can be locked.
public boolean tryLock()
Return true
(and lock the mutex) if the mutex can be locked without blocking, otherwise false
.
true
(and lock the mutex) if the mutex can be locked without blocking, otherwise false
.public void unlock()
Unlock the mutex, which must have previously been locked by the current thread using ReentrantMutex.lock
or ReentrantMutex.tryLock
.