/// <summary>
 /// Stop the background thread. If it is already stopped, do nothing.
 /// </summary>
 private void StopBackgroundThread()
 {
     if (BackgroundThread.IsAlive)
     {
         Stopping = true;
         Flush();
         BackgroundThread.Join();
     }
 }
Example #2
0
 public void Close()
 {
     BackgroundThreadContinue = false;
     BackgroundThread.Interrupt();
     BackgroundThread.Abort();
     BackgroundThread.Join();
     Send("Have a nice day!");
     ClientSocket.Close();
     ClientProcess.Close();
     OnExited(this);
 }
Example #3
0
 // Stops the background thread and its {@link Handler}.
 private void StopBackgroundThread()
 {
     BackgroundThread.QuitSafely();
     try
     {
         BackgroundThread.Join();
         BackgroundThread  = null;
         BackgroundHandler = null;
     }
     catch (InterruptedException e)
     {
         e.PrintStackTrace();
     }
 }