IsEntered Method
Collapse the table of content
Expand the table of content

Monitor.IsEntered Method (Object)

.NET Framework (current version)
 

Determines whether the current thread holds the lock on the specified object.

Namespace:   System.Threading
Assembly:  mscorlib (in mscorlib.dll)

Public Shared Function IsEntered (
	obj As Object
) As Boolean

Parameters

obj
Type: System.Object

The object to test.

Return Value

Type: System.Boolean

true if the current thread holds the lock on obj; otherwise, false.

Exception Condition
ArgumentNullException

obj is null.

This method works only for locks that are acquired by using the methods of the Monitor class, or by using the C# lock statement or the Visual Basic SyncLock statement, which are implemented with Monitor.

Use this method with diagnostic tools, such as the Assert method and the Contract class, to debug locking issues that involve the Monitorclass.

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2016 Microsoft