public void Terminated(Pipe pipe)
{
// Drop the reference to the deallocated pipe.
Debug.Assert(m_pipe == pipe || m_terminatingPipes.Contains(pipe));
if (m_pipe == pipe)
// If this is our current pipe, remove it
m_pipe = null;
else
// Remove the pipe from the detached pipes set
m_terminatingPipes.Remove(pipe);
if (!IsTerminating && m_options.RawSocket)
{
if (m_engine != null)
{
m_engine.Terminate();
m_engine = null;
}
Terminate();
}
// If we are waiting for pending messages to be sent, at this point
// we are sure that there will be no more messages and we can proceed
// with termination safely.
if (m_pending && m_pipe == null && m_terminatingPipes.Count == 0)
ProceedWithTerm();
}