Package org.jcsp.lang

Class ParThread

  • All Implemented Interfaces:
    java.lang.Runnable

    class ParThread
    extends java.lang.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:
    CSProcess, ProcessManager, Parallel
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Barrier barrier
      the barrier at the end of a PAR
      private Barrier park
      parking barrier for this thread
      private CSProcess process
      the process to be executed
      private boolean running  
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      ParThread​(CSProcess process, Barrier barrier)
      Construct a new ParThread.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void release()
      Releases the ParThread to do some more work.
      void reset​(CSProcess process, Barrier barrier)
      reset the ParThread.
      void run()
      The main body of this process.
      void terminate()
      Sets the ParThread to terminate next time it's unparked.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • 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 Detail

      • 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 Detail

      • 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 java.lang.Runnable
        Overrides:
        run in class java.lang.Thread