int threadWhoTookLock;
readonly bool isThreadOwnerTrackingEnabled;
+ static Watch sw = Watch.StartNew ();
+
public bool IsThreadOwnerTrackingEnabled {
get {
return isThreadOwnerTrackingEnabled;
if (isThreadOwnerTrackingEnabled && IsHeldByCurrentThread)
throw new LockRecursionException ();
- Watch sw = Watch.StartNew ();
+ long start = milliSeconds == -1 ? 0 : sw.ElapsedMilliseconds;
do {
long u = ticket.Users;
threadWhoTookLock = Thread.CurrentThread.ManagedThreadId;
break;
}
- } while (milliSeconds == -1 || (milliSeconds > 0 && sw.ElapsedMilliseconds < milliSeconds));
+ } while (milliSeconds == -1 || (sw.ElapsedMilliseconds - start) < milliSeconds);
}
public void Exit ()