CSharpTest.Net
SafeLock Constructor(Object,Int32)
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Synchronization Namespace > SafeLock Structure > SafeLock Constructor : SafeLock Constructor(Object,Int32)

monitor
timeoutMilliseconds

Glossary Item Box

Acquires the monitor lock on the object within timeoutMilliseconds, or throws TimeoutException

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal monitor As Object, _
   ByVal timeoutMilliseconds As Integer _
)
C# 
public SafeLock( 
   object monitor,
   int timeoutMilliseconds
)

Parameters

monitor
timeoutMilliseconds

Example

Library/Library.Test/LockingTests/TestLockingStructs.cs

C#Copy Code
object instance = new object();
using (IDisposable safeLock = new SafeLock(instance, 0))
{
    safeLock.Dispose();//since the using statement has the same boxed pointer to r, we are allowed to dispose
}
VB.NETCopy Code
Dim instance As New Object()
Using safeLock As IDisposable = New SafeLock(instance, 0)
        'since the using statement has the same boxed pointer to r, we are allowed to dispose
    safeLock.Dispose()
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