/// <summary> /// Stop the background thread. If it is already stopped, do nothing. /// </summary> private void StopBackgroundThread() { if (BackgroundThread.IsAlive) { Stopping = true; Flush(); BackgroundThread.Join(); } }
public void Close() { BackgroundThreadContinue = false; BackgroundThread.Interrupt(); BackgroundThread.Abort(); BackgroundThread.Join(); Send("Have a nice day!"); ClientSocket.Close(); ClientProcess.Close(); OnExited(this); }
// 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(); } }