/// <summary> /// Add a lock as a depenedtent of this lock. /// </summary> /// <param name="lockInfo">The lock information.</param> public void AddDependent(LockInfo lockInfo) { #if !CAPTURE_STACK_TRACES if (this.IsDependent(lockInfo)) { return; } #endif DependentLockInfo foundInfo = null; foreach (DependentLockInfo dependLockInfo in this._dependentLocks) { if (dependLockInfo.LockInfo == lockInfo) { foundInfo = dependLockInfo; break; } } if (foundInfo == null) { foundInfo = new DependentLockInfo(lockInfo); this._dependentLocks.Add(foundInfo); } #if CAPTURE_STACK_TRACES StackTrace callStack = new StackTrace(true); foreach (StackTrace currentTraces in foundInfo.CallStacks) { if (IsSameCallStack(callStack, currentTraces)) { return; } } foundInfo.CallStacks.Add(callStack); #endif }
/// <summary> /// Add a lock as a depenedtent of this lock. /// </summary> /// <param name="lockInfo">The lock information.</param> public void AddDependent(LockInfo lockInfo) { #if !CAPTURE_STACK_TRACES if (this.IsDependent(lockInfo)) { return; } #endif DependentLockInfo foundInfo = null; foreach (DependentLockInfo dependLockInfo in this._dependentLocks) { if (dependLockInfo.LockInfo == lockInfo) { foundInfo = dependLockInfo; break; } } if (foundInfo == null) { foundInfo = new DependentLockInfo(lockInfo); this._dependentLocks.Add(foundInfo); } #if CAPTURE_STACK_TRACES StackTrace callStack = new StackTrace(true); foreach (StackTrace currentTraces in foundInfo.CallStacks) { if (IsSameCallStack(callStack, currentTraces)) return; } foundInfo.CallStacks.Add(callStack); #endif }