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; }
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); }