org.objectweb.dream.synchro
Interface Condition

All Known Implementing Classes:
ConditionImpl, ConditionReEntrantImpl

public interface Condition

A condition component aima at synchronizing the execution of several components. Condition components use Mutexcomponents.

Note: Inspired by Doug Lea's implementation.

See Also:
Mutex

Field Summary
static String ITF_NAME
          The commonly used name to refer to this interface.
 
Method Summary
 void await()
          Wait for notification.
 void signal()
          Notify a waiting thread.
 void signalAll()
          Notify all waiting threads *
 boolean timedwait(long msecs)
          Wait for at most msecs for notification.
 

Field Detail

ITF_NAME

static final String ITF_NAME
The commonly used name to refer to this interface.

See Also:
Constant Field Values
Method Detail

await

void await()
           throws InterruptedException
Wait for notification. This operation at least momentarily releases the mutex. The mutex is always held upon return, even if interrupted.

Throws:
InterruptedException - if the thread was interrupted before or during the wait. However, if the thread is interrupted after the wait but during mutex re-acquisition, the interruption is ignored, while still ensuring that the currentThread's interruption state stays true, so can be probed by callers.

timedwait

boolean timedwait(long msecs)
                  throws InterruptedException
Wait for at most msecs for notification. This operation at least momentarily releases the mutex. The mutex is always held upon return, even if interrupted.

Parameters:
msecs - The time to wait. A value less than or equal to zero causes a momentarily release and re-acquire of the mutex, and always returns false.
Returns:
false if at least msecs have elapsed upon resumption; else true. A false return does NOT necessarily imply that the thread was not notified. For example, it might have been notified after the time elapsed but just before resuming.
Throws:
InterruptedException - if the thread was interrupted before or during the wait.

signal

void signal()
Notify a waiting thread. If one exists, a non-interrupted thread will return normally (i.e., not via InterruptedException) from await or timedwait.


signalAll

void signalAll()
Notify all waiting threads *



Copyright © 2003, 2005 - INRIA Rhone-Alpes - All Rights Reserved.