NuGetConsole.Host.PowerShell.Implementation.RunspaceDispatcher.MakeDefault C# (CSharp) Method

MakeDefault() public method

public MakeDefault ( ) : void
return void
        public void MakeDefault()
        {
            if (Runspace.DefaultRunspace == null)
            {
                lock (_dispatcherLock)
                {
                    if (Runspace.DefaultRunspace == null)
                    {
                        // Set this runspace as DefaultRunspace so I can script DTE events.
                        //
                        // WARNING: MSDN says this is unsafe. The runspace must not be shared across
                        // threads. I need this to be able to use ScriptBlock for DTE events. The
                        // ScriptBlock event handlers execute on DefaultRunspace.

                        Runspace.DefaultRunspace = _runspace;
                    }
                }
            }
        }