code: @Override
      public void run()
      {
          if (running.compareAndSet(IDLE, RUNNING))
          {
              sequenceBarrier.clearAlert();
  
              notifyStart();
              try
              {
                  if (running.get() == RUNNING)
                  {
                      processEvents();
                  }
              }
              finally
              {
                  notifyShutdown();
                  running.set(IDLE);
              }
          }
          else
          {
              // This is a little bit of guess work.  The running state could of changed to HALTED by
              // this point.  However, Java does not have compareAndExchange which is the only way
              // to get it exactly correct.
              if (running.get() == RUNNING)
              {
                  throw new IllegalStateException("Thread is already running");
              }
              else
              {
                  earlyExit();
              }
          }
      }
docs: It is ok to have another thread rerun this method after a halt().
  
  @throws IllegalStateException if this object instance is already running in a thread