|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjodd.util.Mutex
public class Mutex
Provides simple mutual exclusion.
Interesting, the previous implementation based on Leslie Lamport's "Fast Mutal Exclusion" algorithm was not working, probably due wrong implementation.
Object (i.e. resource) that uses Mutex must be accessed only between
lock()
and unlock()
.
Constructor Summary | |
---|---|
Mutex()
|
Method Summary | |
---|---|
void |
lock()
Blocks execution and acquires a lock. |
boolean |
tryLock()
Acquires a lock. |
void |
unlock()
Releases a lock. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Mutex()
Method Detail |
---|
public void lock()
public boolean tryLock()
false
,
public void unlock()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |