示例#1
0
        /// <summary>
        /// Indicates whether the specified data store has an active writer.
        /// </summary>
        /// <param name="storeName">The store name.</param>
        /// <param name="storePath">The store path.</param>
        /// <returns>Returns true if there is an active data file writer to this store.</returns>
        public static bool IsStoreLive(string storeName, string storePath)
        {
            if (!Mutex.TryOpenExisting(InfiniteFileWriter.ActiveWriterMutexName(storePath, PsiStoreCommon.GetCatalogFileName(storeName)), out Mutex writerActiveMutex))
            {
                return(false);
            }

            writerActiveMutex.Dispose();
            return(true);
        }
示例#2
0
        /// <summary>
        /// Indicates whether the specified file has an active writer.
        /// </summary>
        /// <param name="name">Infinite file name.</param>
        /// <param name="path">Infinite file path.</param>
        /// <returns>Returns true if there is an active writer to this file.</returns>
        public static bool IsActive(string name, string path)
        {
            Mutex writerActiveMutex;

            if (!Mutex.TryOpenExisting(InfiniteFileWriter.ActiveWriterMutexName(path, name), out writerActiveMutex))
            {
                return(false);
            }

            writerActiveMutex.Dispose();
            return(true);
        }