se.lth.cs.realtime
Class Condition

java.lang.Object
  extended byse.lth.cs.realtime.RTSystem
      extended byse.lth.cs.realtime.Condition

public final class Condition
extends RTSystem

Providing enhanced {wait() | wait(timeout) | notify() | notifyAll()} methods, acting on the already locked object provided as the first argument for all methods. That is, the calling thread must first own the monitor lock via the use of synchronized. The enhancements are:

Hence, notify() and notifyAll() are not changed; they are included here for completeness and simply calls the corresponding method in Object.

Remark: The inheritance from RTSystem is purely for the implementation of wait with timeout, optionally based on virtual time suitable for debugging.


Field Summary
 
Fields inherited from class se.lth.cs.realtime.RTSystem
lag, PRIORITY_BASED, PRIORITY_STRICT, REAL_TIME, seq, TICK_BASED, TIMEOUT_MS, TIMEOUT_NS, tol
 
Constructor Summary
Condition()
           
 
Method Summary
static void notify(java.lang.Object monitor)
          Replacement for java.lang.Object.notify().
static void notifyAll(java.lang.Object monitor)
          Replacement for java.lang.Object.wait().
static void wait(java.lang.Object monitor)
          Replacement for java.lang.Object.wait().
static void wait(java.lang.Object monitor, long timeout)
          Call wait(timeout) in monitor, but considering application time before return.
 
Methods inherited from class se.lth.cs.realtime.RTSystem
currentTimeMillis, getDefaultEventBufferSize, getMaxEventBufferSize, getTickMillis, getTickNanos, sleep, sleep, sleepUntil
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Condition

public Condition()
Method Detail

notify

public static void notify(java.lang.Object monitor)
Replacement for java.lang.Object.notify().

Parameters:
monitor - the monitor that the caller has locked via synchronized.
Throws:
java.lang.IllegalMonitorStateException - when the monitor is not held by the calling thread.

notifyAll

public static void notifyAll(java.lang.Object monitor)
Replacement for java.lang.Object.wait().

Parameters:
monitor - the monitor that the caller has synchronized upon.
Throws:
RTInterrupted - when the calling thread has been interrupted.
java.lang.IllegalMonitorStateException - when the monitor is not held by the calling thread.

wait

public static void wait(java.lang.Object monitor)
Replacement for java.lang.Object.wait().

Parameters:
monitor - the monitor that the caller have synchronized upon.
Throws:
RTInterrupted - when the calling thread has been interrupted.
java.lang.IllegalMonitorStateException - when the monitor is not held by the calling thread.

wait

public static void wait(java.lang.Object monitor,
                        long timeout)
Call wait(timeout) in monitor, but considering application time before return.

Parameters:
monitor - The object in which notify is waited for.
timeout - The waiting time after which we want to give up.
Throws:
java.lang.IllegalMonitorStateException - when the monitor is not held by the calling thread.