void ProcessExited(IAsyncOperation oper) { lock (this) { Counters.ExternalHostProcesses--; // Remove all callbacks from existing objects foreach (object ob in remoteObjects) { RemotingService.UnregisterMethodCallback(ob, "Dispose"); } remoteObjects.Clear(); exitedEvent.Set(); // If the remote process crashes, a thread may be left hung in WaitForExit. This will awaken it. exitRequestEvent.Set(); if (oper != process) { return; } // The process suddently died runningEvent.Reset(); processHost = null; process = null; references = 0; } }
void ProcessExited(IAsyncOperation oper) { lock (this) { Counters.ExternalHostProcesses--; // Remove all callbacks from existing objects foreach (object ob in remoteObjects) { RemotingService.UnregisterMethodCallback(ob, "Dispose"); } remoteObjects.Clear(); exitedEvent.Set(); if (oper != process) { return; } // The process suddently died runningEvent.Reset(); processHost = null; process = null; references = 0; } }