CSharpTest.Net
SimpleReadWriteLocking Constructor()
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Synchronization Namespace > SimpleReadWriteLocking Class > SimpleReadWriteLocking Constructor : SimpleReadWriteLocking Constructor()

Glossary Item Box

Constructs the reader-writer lock using 'this' as the syncronization object

Syntax

Visual Basic (Declaration) 
Public Function New()
C# 
public SimpleReadWriteLocking()

Example

BPlusTree/BPlusTree.Test/TestBPlusTreeOptions.cs

C#Copy Code
var options = new BPlusTree<int, int>.OptionsV2(PrimitiveSerializer.Int32, PrimitiveSerializer.Int32)
{
    CreateFile = CreatePolicy.IfNeeded,
    BTreeOrder = 4
};
var copy = options.Clone();

Assert.IsFalse(Object.ReferenceEquals(options, copy));
Assert.IsFalse(Object.ReferenceEquals(options.CallLevelLock, copy.CallLevelLock));

//If we get/set the lock prior to clone we will have the same lock instance.
options.CallLevelLock = new SimpleReadWriteLocking();
copy = options.Clone();

Assert.IsFalse(Object.ReferenceEquals(options, copy));
Assert.IsTrue(Object.ReferenceEquals(options.CallLevelLock, copy.CallLevelLock));
VB.NETCopy Code
Dim options As var = New BPlusTree(Of Integer, Integer).OptionsV2(PrimitiveSerializer.Int32, PrimitiveSerializer.Int32) With { _
    Key .CreateFile = CreatePolicy.IfNeeded, _
    Key .BTreeOrder = 4 _
}
Dim copy As var = options.Clone()

Assert.IsFalse([Object].ReferenceEquals(options, copy))
Assert.IsFalse([Object].ReferenceEquals(options.CallLevelLock, copy.CallLevelLock))

'If we get/set the lock prior to clone we will have the same lock instance.
options.CallLevelLock = New SimpleReadWriteLocking()
copy = options.Clone()

Assert.IsFalse([Object].ReferenceEquals(options, copy))
Assert.IsTrue([Object].ReferenceEquals(options.CallLevelLock, copy.CallLevelLock))

Requirements

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

See Also

Reference

SimpleReadWriteLocking Class
SimpleReadWriteLocking Members
Overload List

Used By

TestBPlusTreeOptions.TestCloneWithCallLockV1()
TestBPlusTreeOptions.TestCloneWithCallLockV2()

Source Code

Library/Synchronization/SimpleReadWriteLocking.cs

Generated with Document! X 2011 by Innovasys