Пример #1
0
        /// <summary>
        /// Creates a new instance and tries to aquire a lock.
        /// </summary>
        /// <param name="key">The named lock key.</param>
        /// <param name="waitTimeoutMilliseconds">The wait timeout milliseconds.</param>
        public static NamedLock CreateAndEnter(string key, int waitTimeoutMilliseconds)
        {
            NamedLock item;

            item = new NamedLock(key);
            item.Enter(waitTimeoutMilliseconds);
            return(item);
        }
Пример #2
0
        /// <summary>
        /// Creates a new instance and tries to aquire a lock.
        /// </summary>
        /// <param name="key">The named lock key.</param>
        public static NamedLock CreateAndEnter(string key)
        {
            NamedLock item;

            item = new NamedLock(key);
            item.Enter();
            return(item);
        }