Releases the monitor lock. If one or more threads are waiting to acquire the lock, and the current thread has executed Exit as many times as it has executed Enter, one of the threads will be unblocked and allowed to proceed.
[Visual Basic] Public Shared Sub Exit( _ ByVal obj As Object _ ) [C#] public static void Exit( object obj ); [C++] public: static void Exit( Object* obj ); [JScript] public static function Exit( obj : Object );
Exception Type | Condition |
---|---|
ArgumentNullException | If obj is a null reference (in Visual Basic Nothing). |
ArgumentException | If obj is a value type. |
SynchronizationLockException | If the current thread does not own the lock. |
If the current thread owns the lock, the lock count is decremented for the specified object. If the count goes to zero (Exit has been executed as many times as Enter), other threads waiting on the object can acquire the lock.
Monitor Class | Monitor Members | System.Threading Namespace | Thread