System.Threading.ReaderWriterLockSlim.EnterWriteLock Method

Tries to enter the lock in write mode.

Syntax

public void EnterWriteLock ()

Remarks

This method blocks until the calling thread enters the lock, and therefore might never return. Use the erload:System.Threading.ReaderWriterLockSlim.TryEnterWriteLock method to block for a specified interval, and then return if the calling thread has not entered write mode during that interval.

If other threads have entered the lock in read mode, a thread that calls the ReaderWriterLockSlim.EnterWriteLock method blocks until those threads have exited read mode. When there are threads waiting to enter write mode, additional threads that try to enter read mode or upgradeable mode block until all the threads waiting to enter write mode have either timed out or entered write mode and then exited from it.

Note:

If a lock allows recursion, a thread that has entered the lock in write mode can enter write mode recursively, even if other threads are waiting to enter write mode.

Requirements

Namespace: System.Threading
Assembly: System.Core (in System.Core.dll)
Assembly Versions: 4.0.0.0