Example #1
0
            public void Stop(bool callbackOnFinished)
            {
                lock (workerlock)
                {
                    if (workerrunning)
                    {
                        if (workerconnected)
                        {
                            clipboard.UnregisterClient();
                            workerconnected = false;
                        }
                        comms.CloseMessagePipes();

                        wmisession.Log("Stopping worker process " + worker.DangerousGetHandle().ToString());
                        registeredWorkerWaiter.Unregister(null);
                        try
                        {
                            // Don't kill the process.  If we have closed the Pipes, then that should be sufficient
                            // Win32Impl.KillProcess(worker.DangerousGetHandle(), 1);
                        }
                        catch
                        {
                            //If we fail to kill, we want to ignore this fact.  An error is already logged.
                        }
                        workerrunning = false;
                        if (callbackOnFinished)
                        {
                            wphandler.WorkerProcessFinished();
                        }
                    }
                }
            }