|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoodsjpi.Mutex
Class for providing mutual exclusion of threads. Only one thread can enter critical section guarded by mutex (but can do it several times).
Field Summary | |
protected int |
nBlocked
|
protected int |
nested
|
protected java.lang.Thread |
owner
|
Constructor Summary | |
Mutex()
|
Method Summary | |
void |
enter()
Lock mutex. |
boolean |
enter(long timeout)
Try to lock mutex within specified period of time. |
void |
leave()
Release mutex. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.Thread owner
protected int nested
protected int nBlocked
Constructor Detail |
public Mutex()
Method Detail |
public void enter()
public boolean enter(long timeout)
timeout
- the maximum time to wait in milliseconds.
true
if mutex is successfully locked,
false
if enter()
was terminated
due to timeout expiration.public void leave()
leave()
invocations is equal to the number of enter()
invocations.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |