|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.os.ConditionVariable
public class ConditionVariable
Class that implements the condition variable locking paradigm.
This differs from the built-in java.lang.Object wait() and notify() in that this class contains the condition to wait on itself. That means open(), close() and block() are sticky. If open() is called before block(), block() will not block, and instead return immediately.
This class uses itself is at the object to wait on, so if you wait() or notify() on a ConditionVariable, the results are undefined.
| Constructor Summary | |
|---|---|
ConditionVariable()
Create the ConditionVariable in the default closed state. |
|
ConditionVariable(boolean state)
Create the ConditionVariable with the given state. |
|
| Method Summary | |
|---|---|
void |
block()
Block the current thread until the condition is opened. |
boolean |
block(long timeout)
Block the current thread until the condition is opened or until timeout milliseconds have passed. |
void |
close()
Reset the condition to the closed state. |
void |
open()
Open the condition, and release all threads that are blocked. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConditionVariable()
public ConditionVariable(boolean state)
Pass true for opened and false for closed.
| Method Detail |
|---|
public void open()
Any threads that later approach block() will not block unless close() is called.
public void close()
Any threads that call block() will block until someone calls open.
public void block()
If the condition is already opened, return immediately.
public boolean block(long timeout)
If the condition is already opened, return immediately.
timeout - the minimum time to wait in milliseconds.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||