ist.palcom.palcomthreads
Class PalcomThread

java.lang.Object
  extended by ist.palcom.palcomthreads.PalcomThread
Direct Known Subclasses:
PalcomPriorityThread

public abstract class PalcomThread
extends java.lang.Object


Constructor Summary
PalcomThread()
           
 
Method Summary
 boolean askEvent()
           
 void disableIOEvents()
          Cancel previous call to enableIOEvent.
 void disablePeriodicEvents()
          Stop delivering PeriodicEvents.
 void enableIOEvent(Channel channel, int timeout)
          Order an IOAvailableEvent to be delivered when input is available on the Channel channel, or deliver an IOTimeoutEvent after timeout milliseconds if no input came.
 void enablePeriodicEvents(long period)
          Order a PeriodicEvent for delivery every period milliseconds.
 PalcomScheduler getScheduler()
           
 void putEvent(Event event)
          Deposit an event for this PalcomThread.
 void run()
          This method is overridden by subclasses.
 void terminate()
          Permanently remove this PalcomThread from scheduling.
 Event waitEvent()
           
 void yield()
          Give other PalcomThreads with the same or higher priority a chance to execute (if any).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PalcomThread

public PalcomThread()
Method Detail

run

public void run()
This method is overridden by subclasses.


getScheduler

public PalcomScheduler getScheduler()
Returns:
Reference to the PalcomScheduler of this PalcomThread (if any).

terminate

public void terminate()
Permanently remove this PalcomThread from scheduling.


yield

public void yield()
Give other PalcomThreads with the same or higher priority a chance to execute (if any).


waitEvent

public Event waitEvent()
Returns:
The next event in the mailbox of this PalcomThread, or block until one arrives.

askEvent

public boolean askEvent()
Returns:
true if there are pending event(s) in this PalcomThread's mailbox, else return false.

putEvent

public void putEvent(Event event)
Deposit an event for this PalcomThread.


enablePeriodicEvents

public void enablePeriodicEvents(long period)
Order a PeriodicEvent for delivery every period milliseconds. If PeriodicEvents have already been ordered for this PalcomThread, that order is cancelled.


disablePeriodicEvents

public void disablePeriodicEvents()
Stop delivering PeriodicEvents.


enableIOEvent

public void enableIOEvent(Channel channel,
                          int timeout)
Order an IOAvailableEvent to be delivered when input is available on the Channel channel, or deliver an IOTimeoutEvent after timeout milliseconds if no input came. Never deliver both. If IOEvents have already been ordered for this PalcomThread, that order is cancelled.


disableIOEvents

public void disableIOEvents()
Cancel previous call to enableIOEvent.