Package org.jcsp.lang

Class ParThread

java.lang.Object
java.lang.Thread
org.jcsp.lang.ParThread
All Implemented Interfaces:
Runnable

class ParThread extends Thread
This is the Thread class used by Parallel to run all but one of its given processes.

Description

A ParThread is a Thread used by Parallel to run all but one of its given processes.

The CSProcess to be executed can be changed using the setProcess method providing the ParThread is not active.

See Also:
  • Field Details

    • process

      private CSProcess process
      the process to be executed
    • barrier

      private Barrier barrier
      the barrier at the end of a PAR
    • running

      private boolean running
    • park

      private Barrier park
      parking barrier for this thread
  • Constructor Details

    • ParThread

      public ParThread(CSProcess process, Barrier barrier)
      Construct a new ParThread.
      Parameters:
      process - the process to be executed
      barrier - the barrier for then end of the PAR
  • Method Details

    • reset

      public void reset(CSProcess process, Barrier barrier)
      reset the ParThread.
      Parameters:
      process - the process to be executed
      barrier - the barrier for then end of the PAR
    • terminate

      public void terminate()
      Sets the ParThread to terminate next time it's unparked.
    • release

      public void release()
      Releases the ParThread to do some more work.
    • run

      public void run()
      The main body of this process. above.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread