Example #1
0
 public static void TryEnter(object obj, ref bool lockTaken)
 {
     if (lockTaken)
     {
         Monitor.ThrowLockTakenException();
     }
     Monitor.ReliableEnterTimeout(obj, 0, ref lockTaken);
 }
Example #2
0
 public static void TryEnter(object obj, TimeSpan timeout, ref bool lockTaken)
 {
     if (lockTaken)
     {
         Monitor.ThrowLockTakenException();
     }
     Monitor.ReliableEnterTimeout(obj, Monitor.MillisecondsTimeoutFromTimeSpan(timeout), ref lockTaken);
 }