Пример #1
0
        /// <summary>
        /// free all used ressources,
        /// abort all work
        /// </summary>
        public void stop_instance()
        {
            //delete old mutex
            bool initial_owned;

            System.Threading.Mutex shm_mutex = new System.Threading.Mutex(true, "Global\\" + export_name + "_mutex", out initial_owned);
            if (!initial_owned)
            {
                shm_mutex.WaitOne(250);
            }

            if (memory_file != null && memory_file.SafeMemoryMappedFileHandle.IsInvalid != true)
            {
                memory_file.Dispose();
            }
            memory_file = null;

            shm_mutex.ReleaseMutex();
            shm_mutex.Dispose();
            shm_mutex = null;

            memory_file_size = 0;
            _in_progress     = false;
        }
 public virtual void Close()
 {
     if (accessor != null)
     {
         try
         {
             accessor.Dispose();
             accessor = null;
         }
         catch { }
     }
     if (this.mmf != null)
     {
         try
         {
             mmf.Dispose();
             mmf = null;
         }
         catch { }
     }
     disposed = true;
     GC.SuppressFinalize(this);
 }