title: Finish the service and stop the thread
body: <p>I have several services and use threads to implement each one. The services are executed sequentially. Let me just pick up one for demo purpose.</p>
  
  <pre><code>            services[1] = new RProcessing() { ConsoleInfoColor = ConsoleColor.Cyan };
              success = services[1].Start();
              if (success)
              {
                  OutputUtils.WriteLogInfo("Service " + services[1].Name + " started...");
              }
              else
              {
                  OutputUtils.WriteLogInfo("Service " + services[1].Name + " failed to start...");
                  previousStartup = false;
                  services[0].Stop();
              }
  </code></pre>
  
  <p>Inside RProcessing. </p>
  
  <pre><code>    public RProcessing()
      {
          worker = new Thread[1]; // Only one thread
          for (int i = 0; i &lt; 1; i++)
          {
              worker[i] = new Thread(new ThreadStart(ServiceLoop));
              worker[i].Name = "R Thread_" + i.ToString();
          }
          // processing
      }
      public bool Start()
      {
          foreach (Thread t in worker)
              t.Start();
          return (true);
      }
  
      public bool Stop()
      {
          if (_isRunning)
          {
              _isRunning = false;
          }
          _isRunning = false;
          base.Dispose();
          WriteLogInfo("Shutdown of R Processor complete");
          return (true);
      }
  
      public void ServiceLoop()
      {
          _isRunning = true;
          WriteLogInfo("Starting ServiceLoop() for: " + Assembly.GetAssembly(typeof(RProcessing)).FullName);
          string s;
          while (_isRunning)
          {
              Thread.Sleep(500);
              s = null;
              try
              { 
                  WriteLogInfo(" processing "+s);
                  Thread.Sleep(864);// 24 hours.
              }
              catch (Exception ex)
              {
                  WriteLogError("Thread " + Thread.CurrentThread.Name + "     " + ex.ToString());
              }
  
          }
          if (this._isRunning)
          {
              WriteLogInfo("Restarting thread due to failure...");
              try
              {
                  Thread.CurrentThread.Start();
              }
              catch (Exception ex)
              {
                  WriteLogError("Error restarting thread... " + ex.ToString());
              }
          }
      }
  </code></pre>
  
  <p>Only there is one thread, I want to finish it then go back the next service. However it is always inside the ServiceLoop. How can break it? Just call Stop()?</p>