Exemplo n.º 1
0
        public static void Uninitialize()
        {
            lock (s_storage_init_lock)
                lock (s_comm_instance_lock)
                {
                    if (communication_instance != null)
                    {
                        communication_instance.Stop();
                    }

                    generic_cell_ops = null;
                    storage_schema   = null;
                    if (isLocalStorageInited)
                    {
                        local_storage.Dispose();
                        local_storage        = null;
                        isLocalStorageInited = false;
                    }

                    if (isCloudStorageInited)
                    {
                        cloud_storage.Dispose();
                        isCloudStorageInited = false;
                    }

                    BackgroundThread.Stop();
                    s_master_init_flag = false;
                }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Syncronously ends a previous call that began pinging
 /// </summary>
 public void EndPinging()
 {
     // if the thread is running
     if (_thread.IsRunning)
     {
         // stut it down
         _thread.Stop();
     }
 }
        public override void OnStartPrint(PrintDocument document, PrintEventArgs e)
        {
            base.OnStartPrint(document, e);

            this._document = document;
            _pageNumber    = 1;

            if (SystemInformation.UserInteractive)
            {
                _backgroundThread = new BackgroundThread(this); // starts running & shows dialog automatically
            }

            // OnStartPrint does the security check... lots of
            // extra setup to make sure that we tear down
            // correctly...
            //
            try
            {
                _underlyingController.OnStartPrint(document, e);
            }
            catch
            {
                if (_backgroundThread is not null)
                {
                    _backgroundThread.Stop();
                }

                throw;
            }
            finally
            {
                if (_backgroundThread is not null && _backgroundThread._canceled)
                {
                    e.Cancel = true;
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Uninitializes the Graph Engine, including the
        /// communication instance, message passing, and local memory storage.
        /// </summary>
        public static void Uninitialize()
        {
            lock (s_storage_init_lock)
                lock (s_comm_instance_lock)
                {
                    if (communication_instance != null)
                    {
                        communication_instance.Stop();
                    }

                    generic_cell_ops = null;
                    storage_schema   = null;
                    if (isLocalStorageInited)
                    {
                        local_storage.Dispose();
                        local_storage        = null;
                        isLocalStorageInited = false;
                    }

                    if (isCloudStorageInited)
                    {
                        cloud_storage.Dispose();
                        isCloudStorageInited = false;
                    }

                    if (TrinityErrorCode.E_SUCCESS != StopEventLoop())
                    {
                        throw new Exception("Cannot stop worker thread pool");
                    }

                    // !Note, BackgroundThread.Stop may write log entries,
                    //  so we uninitialize Log later than BackgroundThread.
                    BackgroundThread.Stop();
                    Log.Uninitialize();
                    s_master_init_flag = false;
                }

            try
            {
                Uninitialized();
            }
            catch
            {
                //TODO log
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Uninitializes the Graph Engine, including the
        /// communication instance, message passing, and local memory storage.
        /// </summary>
        public static void Uninitialize()
        {
            lock (s_storage_init_lock)
                lock (s_comm_instance_lock)
                {
                    if (communication_instance != null)
                    {
                        communication_instance.Stop();
                    }

                    generic_cell_ops = null;
                    storage_schema   = null;
                    if (isLocalStorageInited)
                    {
                        local_storage.Dispose();
                        local_storage        = null;
                        isLocalStorageInited = false;
                    }

                    if (isCloudStorageInited)
                    {
                        cloud_storage.Dispose();
                        isCloudStorageInited = false;
                    }

                    // !Note, BackgroundThread.Stop may write log entries,
                    //  so we uninitialize Log later than BackgroundThread.
                    BackgroundThread.Stop();
                    Log.Uninitialize();
                    s_master_init_flag = false;
                }

            try
            {
                Uninitialized();
            }
            catch
            {
                //TODO log
            }
        }
Exemplo n.º 6
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     backgroundThread.Stop();
 }