public TrackedLock(TrackedLockCollection collection, Func <string> getName = null) { Collection = collection; GetName = getName; collection.Track(this); }
public Wait (TrackedLockCollection collection, TrackedLock lck, Thread thread) { Collection = collection; Lock = lck; Thread = thread; if (!Collection.WaitsByThread.TryAdd(thread, this)) throw new ThreadStateException(); }
public Wait(TrackedLockCollection collection, TrackedLock lck, Thread thread) { Collection = collection; Lock = lck; Thread = thread; if (!Collection.WaitsByThread.TryAdd(thread, this)) { throw new ThreadStateException(); } }
public Entry (QualifiedMemberIdentifier identifier, TrackedLockCollection lockCollection) { Identifier = identifier; StaticAnalysisDataLock = new TrackedLock(lockCollection, () => String.Format("{0}", this.Identifier.ToString())); }
public TrackedLock(TrackedLockCollection collection, string name) : this(collection, () => name) { }
public TrackedLock(TrackedLockCollection collection, Func <string> getName = null) { Collection = collection; GetName = getName; WeakSelf = new WeakTrackedLockReference(this); }
public TrackedLockResult TryBlockingEnter (out TrackedLockCollection.DeadlockInfo deadlock, bool recursive = false, int timeoutMs = -1) { bool iterating = true; TrackedLockCollection.Wait wait; deadlock = null; while (iterating) { var result = TryEnter(recursive); if (result.FailureReason != TrackedLockFailureReason.HeldByOtherThread) return result; EnsureTracked(); if (Collection.TryCreateWait(WeakSelf, out deadlock, out wait)) { using (wait) { result = TryEnter(recursive); if (result.FailureReason == TrackedLockFailureReason.HeldByOtherThread) { var finishedWaiting = wait.Block(timeoutMs); if (!finishedWaiting) iterating = false; } else { return result; } } } else { return new TrackedLockResult(TrackedLockFailureReason.Deadlock); } } return new TrackedLockResult(TrackedLockFailureReason.HeldByOtherThread); }
public TrackedLock (TrackedLockCollection collection, Func<string> getName = null) { Collection = collection; GetName = getName; WeakSelf = new WeakTrackedLockReference(this); }
public TrackedLock (TrackedLockCollection collection, string name) : this(collection, () => name) { }