Mono Class Library: System.Threading.Monitor Overview | Members

System.Threading.Monitor.Enter Method

Acquires an exclusive lock on the specified object. [Edit]

public static void Enter (object obj)

Parameters

obj
The object on which to acquire the lock. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionobj is null. [Edit]

Remarks

This method acquires an exclusive lock on obj .

A caller of this method is required to invoke Monitor.Exit(object) once for each Monitor.Enter(object) invoked.

The caller of this method is blocked if another thread has obtained the lock by calling Monitor.Enter(object) and specifying the same object. The caller is not blocked if the current thread holds the lock. The same thread can invoke Monitor.Enter(object) more than once (and it will not block); however, an equal number of Monitor.Exit(object) calls are required to be invoked before other threads waiting on the object will unblock.

Note: Invoking this member is identical to using the C# lock statement.

[Edit]

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0