public void Kill() { if (!Running) { return; } Running = false; usedPorts.Remove(this.ServerPort); usedPorts.Remove(this.ClientPort); try { //receiveSocket.EndAccept(new MyAsyncWaste()); receiveSocket.Close(); MainThread.Join(); MainThread.Abort(); } catch (Exception) { } }
/// <summary> /// Finishes the main thread. /// </summary> /// <exception cref="System.Exception">A error occured during termination of DirectOutput MainThread</exception> private void FinishMainThread() { if (MainThread != null) { try { KeepMainThreadAlive = false; lock (MainThreadLocker) { Monitor.Pulse(MainThreadLocker); } if (!MainThread.Join(1000)) { MainThread.Abort(); } MainThread = null; } catch (Exception E) { Log.Exception("A error occured during termination of DirectOutput MainThread", E); throw new Exception("A error occured during termination of DirectOutput MainThread", E); } } }
public void Stop() { IsRunning = false; AcceptReset.Set(); MainThread.Join(); }
public int Execute(NixSystem system, Session session, IList <string> argv) { ExecuteAsync(system, session, argv); MainThread.Join(); return(Result); }