Save This Page
Home » openjdk-7 » sun » misc » [javadoc | source]
sun.misc
public final class: ConditionLock [javadoc | source]
java.lang.Object
   sun.misc.Lock
      sun.misc.ConditionLock
ConditionLock is a Lock with a built in state variable. This class provides the ability to wait for the state variable to be set to a desired value and then acquire the lock.

The lockWhen() and unlockWith() methods can be safely intermixed with the lock() and unlock() methods. However if there is a thread waiting for the state variable to become a particular value and you simply call Unlock(), that thread will not be able to acquire the lock until the state variable equals its desired value.

Constructor:
 public ConditionLock() 
 public ConditionLock(int initialState) 
Method from sun.misc.ConditionLock Summary:
lockWhen,   unlockWith
Methods from sun.misc.Lock:
lock,   unlock
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.misc.ConditionLock Detail:
 public synchronized  void lockWhen(int desiredState) throws InterruptedException 
    Acquires the lock when the state variable equals the desired state.
 public synchronized  void unlockWith(int newState) 
    Releases the lock, and sets the state to a new value.