|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectibis.util.ConditionVariable
Condition variable synchronization construct.
Condition variables are part of thread synchronization primitives of the
Monitor
construct. Threads can wait on a condition variable,
and condition variables can be signalled by other threads to wake up one
waiting thread. A bcast call wakes up all waiting threads on a
ConditionVariable.
A thread that calls cv_wait
, cv_signal
or
cv_bcast
must have locked the Monitor
that owns this
ConditionVariable.
Condition Variables can be interruptible
. For interruptible
Condition Variables, Thread.interrupt
ing the Thread
that
is waiting on this Condition Variable causes the waiting thread to return
with an InterruptedException
. Non-interruptible Condition Variables
ignore Thread.interrupt
.
A Condition variable is created by means of the Monitor.createCV()
or the Monitor.createCV(boolean)
method.
Method Summary | |
void |
cv_bcast()
Signals all threads that are waiting on this condition variable. |
void |
cv_signal()
Signals a single thread that is waiting on this condition variable. |
void |
cv_wait()
Waits until the thread is signalled (by means of cv_signal()
or cv_bcast() ). |
boolean |
cv_wait(long timeout)
Waits until the thread is signalled (by means of cv_signal()
or cv_bcast() ), or the specified timeout expires. |
static void |
report(java.io.PrintStream out)
When statistics are enabled, prints them on the specified stream. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public final void cv_wait() throws java.lang.InterruptedException
cv_signal()
or cv_bcast()
).
java.lang.InterruptedException
- is thrown when the condition variable
was created with interrupts enabled, and Thread.interrupt()
was invoked on the current thread.public final boolean cv_wait(long timeout) throws java.lang.InterruptedException
cv_signal()
or cv_bcast()
), or the specified timeout expires.
timeout
- the specified timeout.
true
when this method returns because the
timeout expired.
java.lang.InterruptedException
- is thrown when the condition variable
was created with interrupts enabled, and Thread.interrupt()
was invoked on the current thread.public final void cv_signal()
public final void cv_bcast()
public static void report(java.io.PrintStream out)
out
- the stream to print on.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |