|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--arlut.csd.Util.booleanSemaphore
Simple, synchronized boolean flag class.
This class is useful for providing a reliable boolean flag that can be examined by separate threads without worry over funky memory model behavior on multiprocessor systems, etc.
| Field Summary | |
private boolean |
state
|
| Constructor Summary | |
booleanSemaphore(boolean initialState)
|
|
| Method Summary | |
boolean |
isSet()
|
boolean |
set(boolean b)
Simple bidirectional test and set. |
void |
waitForCleared()
Safe, simple method to wait until this boolean semaphore has been cleared. |
boolean |
waitForCleared(long millis)
Safe, simple method to wait until this boolean semaphore has been cleared, or until at least millis milliseconds have passed. |
void |
waitForSet()
Safe, simple method to wait until this boolean semaphore has been set. |
boolean |
waitForSet(long millis)
Safe, simple method to wait until this boolean semaphore has been cleared, or until at least millis milliseconds have passed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private boolean state
| Constructor Detail |
public booleanSemaphore(boolean initialState)
| Method Detail |
public boolean isSet()
public boolean set(boolean b)
Simple bidirectional test and set.
public void waitForCleared()
Safe, simple method to wait until this boolean semaphore has been cleared. If the semaphore is already cleared at the time this method is called, this method will return immediately.
Note that this method will not time out.
public boolean waitForCleared(long millis)
Safe, simple method to wait until this boolean semaphore has been cleared, or until at least millis milliseconds have passed. If the semaphore is already cleared at the time this method is called, this method will return immediately.
public void waitForSet()
Safe, simple method to wait until this boolean semaphore has been set. If the semaphore is already set at the time this method is called, this method will return immediately.
Note that this method will not time out.
public boolean waitForSet(long millis)
Safe, simple method to wait until this boolean semaphore has been cleared, or until at least millis milliseconds have passed. If the semaphore is already set at the time this method is called, this method will return immediately.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||