Example #1
0
        /// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
        protected override void Dispose(bool disposing)
        {
            SaveThreadRunning = false;
            SavingEnabled     = false;

            if (SaveThread != null)
            {
                try
                {
                    lock (SaveBufferTrigger)
                    {
                        Monitor.Pulse(SaveBufferTrigger);
                    }
                    //SaveBufferTrigger.Release(1);
                    if (!SaveThread.Join(300))
                    {
                        SaveThread.Abort();
                    }
                }
                catch (Exception e)
                {
                }
                SaveThread = null;
            }

            if (disposing && (components != null))
            {
                components.Dispose();
            }

            base.Dispose(disposing);
        }
Example #2
0
 public void Shutdown()
 {
     if (SaveThread != null)
     {
         if (CacheData.Count > 0)
         {
             try
             {
                 Closing = true;
                 waiter.Set();
                 SaveThread.Join();
                 if (CacheData.Count > 0)
                 {
                     FlushAll();
                 }
             }
             catch (Exception) { }
         }
     }
 }