Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
    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;
    }