/// <summary> Constructs the lock tracking factory </summary>
public DebugLockFactory(ILockFactory factory) : this(factory, false, 30000, 0, false, 0)
{ }
/// <summary> Constructs the lock tracking factory </summary>
public DebugLockFactory(ILockFactory factory, bool captureStack, int limitTimeout, int limitNestedReaders, bool concurrentReads, int limitNestedWriters)
: base(factory)
{
_captureStack = captureStack;
_limitTimeout = limitTimeout;
_limitNestedReaders = limitNestedReaders;
_concurrentReads = concurrentReads;
_limitNestedWriters = limitNestedWriters;
}
/// <summary> Constructs the lock wrapped in a DebugLocking instance </summary>
public override ILockStrategy Create()
{
DebugLocking l = new DebugLocking(base.Create(), _captureStack, _limitTimeout, _limitNestedReaders, true, _limitNestedWriters);
return new DebugLockCounting(this, l);
}
/// <summary> Toggle if the entire stack is captured on lock aquisition/release for newly created locks </summary>
public bool CaptureStack { get { return _captureStack; } set { _captureStack = value; } }
/// <summary> Toggle if reads are allowed even if write lock was acquired </summary>
public bool ConcurrentReads { get { return _concurrentReads; } set { _concurrentReads = value; } }
/// <summary> Timeout limit for newly created locks </summary>
public int LimitTimeout { get { return _limitTimeout; } set { _limitTimeout = Check.InRange(value, -1, int.MaxValue); } }
/// <summary> Reader nesting limit for newly created locks </summary>
public int LimitNestedReaders { get { return _limitNestedReaders; } set { _limitNestedReaders = Check.InRange(value, 0, 64); } }
/// <summary> Writer nesting limit for newly created locks </summary>
public int LimitNestedWriters { get { return _limitNestedWriters; } set { _limitNestedWriters = Check.InRange(value, 0, 64); } }
/// <summary> Returns the total number of current readers for this thread </summary>