예제 #1
0
 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)
     {
     }
 }
예제 #2
0
 /// <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);
         }
     }
 }
예제 #3
0
 public void Stop()
 {
     IsRunning = false;
     AcceptReset.Set();
     MainThread.Join();
 }
예제 #4
0
 public int Execute(NixSystem system, Session session, IList <string> argv)
 {
     ExecuteAsync(system, session, argv);
     MainThread.Join();
     return(Result);
 }