Пример #1
0
        internal void Exit()
        {
            // Stop listening to events
            m_pipResultListener.Cancel();
            m_forwardingEventListener?.Dispose();

            // The execution log target can be null if the worker failed to attach to master
            if (m_executionLogTarget != null)
            {
                m_executionLogTarget.Deactivate();

                // Remove the notify master target to ensure no further events are sent to it.
                // Otherwise, the events that are sent to a disposed target would cause crashes.
                m_scheduler.RemoveExecutionLogTarget(m_executionLogTarget);
                // Dispose the execution log target to ensure all events are processed
                m_executionLogTarget.Dispose();
            }

            if (m_sendThread.IsAlive)
            {
                // Wait for the queues to drain
                m_sendThread.Join();
            }

            m_sendCancellationSource.Cancel();
        }
Пример #2
0
 /// <summary>
 /// Stop trying to communicate with the orchestrator and processing messages
 /// </summary>
 internal void Cancel()
 {
     m_executionLogTarget?.Deactivate();
     m_pipResultListener.Cancel();
     m_forwardingEventListener.Dispose();
     m_sendCancellationSource.Cancel();
 }