Shutdown() static private method

static private Shutdown ( ) : void
return void
Beispiel #1
0
        /// <summary>
        /// Shutdown Method
        /// </summary>
        /// <remarks>
        /// Shutdown and release resources held by the Python runtime. The
        /// Python runtime can no longer be used in the current process
        /// after calling the Shutdown method.
        /// </remarks>
        public static void Shutdown()
        {
            if (initialized)
            {
                Marshal.FreeHGlobal(_pythonHome);
                _pythonHome = IntPtr.Zero;
                Marshal.FreeHGlobal(_programName);
                _programName = IntPtr.Zero;
                Marshal.FreeHGlobal(_pythonPath);
                _pythonPath = IntPtr.Zero;

                Runtime.Shutdown();
                initialized = false;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Shutdown Method
        /// </summary>
        /// <remarks>
        /// Shutdown and release resources held by the Python runtime. The
        /// Python runtime can no longer be used in the current process
        /// after calling the Shutdown method.
        /// </remarks>
        public static void Shutdown()
        {
            if (initialized)
            {
                PyScopeManager.Global.Clear();
                Marshal.FreeHGlobal(_pythonHome);
                _pythonHome = IntPtr.Zero;
                Marshal.FreeHGlobal(_programName);
                _programName = IntPtr.Zero;
                Marshal.FreeHGlobal(_pythonPath);
                _pythonPath = IntPtr.Zero;

                Runtime.Shutdown();

                AppDomain.CurrentDomain.DomainUnload -= OnDomainUnload;
                initialized = false;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Shutdown Method
        /// </summary>
        /// <remarks>
        /// Shutdown and release resources held by the Python runtime. The
        /// Python runtime can no longer be used in the current process
        /// after calling the Shutdown method.
        /// </remarks>
        public static void Shutdown()
        {
            if (initialized)
            {
                // Make sure we shut down properly on app domain reload
                System.AppDomain.CurrentDomain.DomainUnload -= OnDomainUnload;

                PyScopeManager.Global.Clear();
                Marshal.FreeHGlobal(_pythonHome);
                _pythonHome = IntPtr.Zero;
                Marshal.FreeHGlobal(_programName);
                _programName = IntPtr.Zero;
                Marshal.FreeHGlobal(_pythonPath);
                _pythonPath = IntPtr.Zero;

                Runtime.Shutdown();
                initialized = false;
            }
        }