Mono Class Library: System.Threading.Monitor Overview | MembersSystem.Threading.Monitor.Exit Method |
Releases an exclusive lock on the specified object . [Edit]
|
Type Reason ArgumentNullException obj is null. [Edit] System.Threading.SynchronizationLockException The current thread does not own the lock for the specified object. [Edit]
This method releases an exclusive lock on obj. The caller is required to own the lock on obj .
If the caller owns the lock on the specified object, and has made an equal number of Monitor.Exit(object) and Monitor.Enter(object) calls for the object, then the lock is released. If the caller has not invoked Monitor.Exit(object) as many times as Monitor.Enter(object) , the lock is not released.
Note: If the lock is released and there are other threads in the ready queue for the object, one of the threads will acquire the lock. If there are other threads in the waiting queue waiting to acquire the lock, they are not automatically moved to the ready queue when the owner of the lock calls Monitor.Exit(object). To move one or more waiting threads into the ready queue, call Monitor.Pulse(object) or Monitor.PulseAll(object) prior to invoking Monitor.Exit(object).[Edit]
Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0