pt.ua.concurrent
Class TransientSignal

java.lang.Object
  extended by pt.ua.concurrent.CObject
      extended by pt.ua.concurrent.TransientSignal
All Implemented Interfaces:
InterruptibleAwaitingThreads, Signal, SyncCV

public class TransientSignal
extends CObject
implements Signal

A transient signal module (signals thrown away if no one is waiting). This mechanism is similar to the behavior of the signal/await of a condition variable.

This class follows DbC(tm) methodology (Wikipedia). Where possible, contracts are implement with native's Java assert.

Author:
Miguel Oliveira e Silva (mos@ua.pt)

Constructor Summary
TransientSignal()
          Constructs a new TransientSignal registering waiting threads.
TransientSignal(boolean registerAwaitingThreads)
          Constructs a new TransientSignal.
 
Method Summary
 void await()
          Object's wait replacement, in which:
- the checked exception InterruptedException, is replaced by the unchecked exception ThreadInterruptedException;
- supports the registration of waiting threads for interrupt purposes.
 void send()
          Signaling (sender).
 
Methods inherited from class pt.ua.concurrent.CObject
await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pt.ua.concurrent.InterruptibleAwaitingThreads
interruptWaitingThreads, registerAwaitingThreads
 

Constructor Detail

TransientSignal

public TransientSignal()
Constructs a new TransientSignal registering waiting threads.


TransientSignal

public TransientSignal(boolean registerAwaitingThreads)
Constructs a new TransientSignal.

Parameters:
registerAwaitingThreads - if true, threads are registered when waiting
Method Detail

send

public void send()
Description copied from interface: Signal
Signaling (sender).

Specified by:
send in interface Signal

await

public void await()
Description copied from class: CObject
Object's wait replacement, in which:
- the checked exception InterruptedException, is replaced by the unchecked exception ThreadInterruptedException;
- supports the registration of waiting threads for interrupt purposes.

Precondition:
syncronizedLockIsMine() - native lock owned by me

Specified by:
await in interface Signal
Specified by:
await in interface SyncCV
Overrides:
await in class CObject