コード例 #1
0
ファイル: Process.cs プロジェクト: paytonli2013/SharpDevelop
        /// <summary> Terminates the execution of the process </summary>
        public void AsyncTerminate()
        {
            // Resume stoped tread
            if (this.IsPaused)
            {
                // We might get more callbacks so we should maintain consistent sate
                //AsyncContinue(); // Continue the process to get remaining callbacks
            }

            // Expose race condition - drain callback queue
            System.Threading.Thread.Sleep(0);

            // Stop&terminate - both must be called
            try {
                corProcess.Stop(uint.MaxValue);
                corProcess.Terminate(0);
            } catch (COMException ex) {
                if (ex.ErrorCode == unchecked ((int)0x80131301))
                {
                    // COMException (0x80131301): Process was terminated.
                }
                else
                {
                    throw;
                }
            }
            this.TerminateCommandIssued = true;

            // Do not mark the process as exited
            // This is done once ExitProcess callback is received
        }
コード例 #2
0
        public void Terminate()
        {
            // Resume stoped tread
            if (this.IsPaused)
            {
                // We might get more callbacks so we should maintain consistent sate
                this.Continue();                 // TODO: Remove this...
            }

            // Expose race condition - drain callback queue
            System.Threading.Thread.Sleep(0);

            // Stop&terminate - both must be called
            corProcess.Stop(100);             // TODO: ...and this
            corProcess.Terminate(0);
        }
コード例 #3
0
ファイル: Process.cs プロジェクト: kleinux/SharpDevelop
		/// <summary> Terminates the execution of the process </summary>
		public void AsyncTerminate()
		{
			// Resume stoped tread
			if (this.IsPaused) {
				// We might get more callbacks so we should maintain consistent sate
				//AsyncContinue(); // Continue the process to get remaining callbacks
			}
			
			// Expose race condition - drain callback queue
			System.Threading.Thread.Sleep(0);
			
			// Stop&terminate - both must be called
			corProcess.Stop(uint.MaxValue);
			corProcess.Terminate(0);
			this.TerminateCommandIssued = true;
			
			// Do not mark the process as exited
			// This is done once ExitProcess callback is received
		}
コード例 #4
0
 public void Terminate()
 {
     Stop();
     _comProcess.Terminate(0);
 }