public static TimedLock Lock(object o, TimeSpan timeout) { TimedLock tl = new TimedLock(o); if (!Monitor.TryEnter(o, timeout)) { #if DEBUG GC.SuppressFinalize(tl.leakDetector); #endif throw new LockTimeoutException(); } return tl; }
public static TimedLock Lock(object o, TimeSpan timeout) { TimedLock tl = new TimedLock(o); if (!Monitor.TryEnter(o, timeout)) { #if DEBUG GC.SuppressFinalize(tl.leakDetector); #endif throw new LockTimeoutException(); } return(tl); }