public static TimeoutLock Lock(object o, int timeout) { TimeoutLock tl = new TimeoutLock(o); if (Monitor.TryEnter(o, timeout) == false) { #if DEBUG System.GC.SuppressFinalize(tl.leakDetector); #endif Debug.Assert(false); throw new LockTimeoutException(); } return(tl); }
public static TimeoutLock Lock(object o, int timeout) { TimeoutLock tl = new TimeoutLock(o); if (Monitor.TryEnter(o, timeout) == false) { #if DEBUG System.GC.SuppressFinalize(tl.leakDetector); #endif Debug.Assert(false); throw new LockTimeoutException(); } return tl; }