コード例 #1
0
ファイル: PsiStoreReader.cs プロジェクト: yusharth/psi
        /// <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
ファイル: InfiniteFileWriter.cs プロジェクト: vdedyukhin/psi
        /// <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);
        }