CSharpTest.Net
SafeLock Structure
Members  Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Synchronization Namespace : SafeLock Structure

Glossary Item Box

Used to acquire a lock(object) with a timeout, either specified or the default of 2 minutes.

Syntax

Visual Basic (Declaration) 
Public Structure SafeLock 
   Inherits System.ValueType
C# 
public struct SafeLock : System.ValueType 

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

Inheritance Hierarchy

System.Object
   System.ValueType
      CSharpTest.Net.Synchronization.SafeLock

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys