Пример #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
 private static void Signal(object sender, TaskEventArgs e)
 {
 }