CSharpTest.Net
MaxReaderCount Field
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Synchronization Namespace > DebugLocking Class : MaxReaderCount Field

Glossary Item Box

Returns the highest number of concurrent reads

Syntax

Visual Basic (Declaration) 
Public MaxReaderCount As Integer
C# 
public int MaxReaderCount

Example

Library/Library.Test/LockingTests/TestDebugLocking.cs

C#Copy Code
using (DebugLocking<SimpleReadWriteLocking> l = new DebugLocking<SimpleReadWriteLocking>(
    false, 0, 1, false, 1))
{
    Assert.IsFalse(l.CaptureStack);

    Assert.AreEqual(0, l.CurrentReaderCount);
    Assert.AreEqual(0, l.LocalReaderCount);
    Assert.AreEqual(0, l.MaxReaderCount);

    using (l.Read())
    {
        Assert.AreEqual(1, l.CurrentReaderCount);
        Assert.AreEqual(1, l.LocalReaderCount);
        using (l.Read(0))
        {
            Assert.AreEqual(2, l.CurrentReaderCount);
            Assert.AreEqual(2, l.LocalReaderCount);
        }
    }

    Assert.AreEqual(0, l.CurrentReaderCount);
    Assert.AreEqual(0, l.LocalReaderCount);
    Assert.AreEqual(2, l.MaxReaderCount);
}
VB.NETCopy Code
Using l As New DebugLocking(Of SimpleReadWriteLocking)(False, 0, 1, False, 1)
    Assert.IsFalse(l.CaptureStack)

    Assert.AreEqual(0, l.CurrentReaderCount)
    Assert.AreEqual(0, l.LocalReaderCount)
    Assert.AreEqual(0, l.MaxReaderCount)

    Using l.Read()
        Assert.AreEqual(1, l.CurrentReaderCount)
        Assert.AreEqual(1, l.LocalReaderCount)
        Using l.Read(0)
            Assert.AreEqual(2, l.CurrentReaderCount)
            Assert.AreEqual(2, l.LocalReaderCount)
        End Using
    End Using

    Assert.AreEqual(0, l.CurrentReaderCount)
    Assert.AreEqual(0, l.LocalReaderCount)
    Assert.AreEqual(2, l.MaxReaderCount)
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys