public class Mutex extends Object
Constructor and Description |
---|
Mutex() |
Modifier and Type | Method and Description |
---|---|
void |
acquire()
Acquire the mutex.
|
void |
release()
Release the mutex.
|
boolean |
tryToAcquire()
Attempts to acquire the mutex.
|
public void acquire() throws InterruptedException
InterruptedException
public boolean tryToAcquire()
public void release()
IllegalStateException
- (a RuntimeException) if a thread
other than the current owner tries to release the mutex.