Ejemplo n.º 1
0
		public static TimedLock Lock(object obj, TimeSpan timeout)
		{
			TimedLock timedLock = new TimedLock(obj);
			if (!Monitor.TryEnter(obj, timeout))
			{
				#if DEBUG
				GC.SuppressFinalize(timedLock._leakDetector);
				#endif
				throw Error.OperationTimeout(timeout);
			}
			return timedLock;
		}
Ejemplo n.º 2
0
        public static TimedLock Lock(object obj, TimeSpan timeout)
        {
            TimedLock timedLock = new TimedLock(obj);

            if (!Monitor.TryEnter(obj, timeout))
            {
                                #if DEBUG
                GC.SuppressFinalize(timedLock._leakDetector);
                                #endif
                throw Error.OperationTimeout(timeout);
            }
            return(timedLock);
        }