Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
IsEntered Method
Collapse the table of content
Expand the table of content

Monitor::IsEntered Method

.NET Framework 4.6 and 4.5

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

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

public:
static bool IsEntered(
	Object^ obj
)

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.

ExceptionCondition
ArgumentNullException

obj is nullptr.

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 Monitor class.

.NET Framework

Supported in: 4.6, 4.5

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8
Show:
© 2015 Microsoft