コード例 #1
0
            private void processTask_Terminated(object sender, TaskEventArgs e)
            {
                // Verify that everything is correctly set in the callback.
                TaskFlagsAreCorrect();
                ExitCodeIsSet();
                ExitCodeDescriptionIsSet();

                terminatedSuccessfully.Set();
            }
コード例 #2
0
        private void HandleProcessExit(object sender, TaskEventArgs e)
        {
            var processTask = (ProcessTask)e.Task;

            if (! processTask.Result.HasValue)
            {
                Logger.Log(LogSeverity.Error, "Host process encountered an exception.", processTask.Result.Exception);
            }
            else
            {
                var diagnostics = new StringBuilder();
                int exitCode = processTask.ExitCode;
                diagnostics.AppendFormat("Host process exited with code: {0}", exitCode);

                string exitCodeDescription = processTask.ExitCodeDescription;
                if (exitCodeDescription != null)
                    diagnostics.Append(" (").Append(exitCodeDescription).Append(")");

                Logger.Log(exitCode != 0 ? LogSeverity.Error : LogSeverity.Info, diagnostics.ToString());
            }

            NotifyDisconnected();
        }
コード例 #3
0
        private void HandleTaskTerminated(object sender, TaskEventArgs e)
        {
            try
            {
                EventHandler<TaskEventArgs> cachedChain;
                lock (this)
                {
                    cachedChain = terminated;
                }

                EventHandlerPolicy.SafeInvoke(cachedChain, this, e);
            }
            finally
            {
                // Do this last to ensure that all event handlers have executed
                // before we remove the task from the list.  This helps to ensure
                // that JoinAll fully synchronizes with the task and with any
                // final event-based processing that needs to occur.
                lock (this)
                {
                    activeTasks.Remove(e.Task);
                }
            }
        }
コード例 #4
0
        private void HandleTaskAborted(object sender, TaskEventArgs e)
        {
            EventHandler<TaskEventArgs> cachedChain;
            lock (this)
                cachedChain = aborted;

            EventHandlerPolicy.SafeInvoke(cachedChain, this, e);
        }
コード例 #5
0
        private void HandleTaskStarted(object sender, TaskEventArgs e)
        {
            EventHandler<TaskEventArgs> cachedChain;
            lock (this)
            {
                activeTasks.Add(e.Task);
                cachedChain = started;
            }

            EventHandlerPolicy.SafeInvoke(cachedChain, this, e);
        }
コード例 #6
0
ファイル: Task.cs プロジェクト: dougrathbone/mbunit-v3
 private static void Signal(object sender, TaskEventArgs e)
 {
 }