ReaderWriterLock.AcquireWriterLock Method (TimeSpan)
Acquires the writer lock, using a TimeSpan value for the time-out.
Assembly: mscorlib (in mscorlib.dll)
This method blocks if another thread has a reader lock or writer lock. For a description of the way the writer lock alternates with multiple concurrent reader locks, see the ReaderWriterLock class.
If a thread calls AcquireWriterLock while it still has a reader lock, it will block on its own reader lock; if an infinite time-out is specified, the thread will deadlock. To avoid such deadlocks, use IsReaderLockHeld to determine whether the current thread already has a reader lock.
AcquireWriterLock supports recursive writer-lock requests. That is, a thread can call AcquireWriterLock multiple times, which increments the lock count each time. You must call ReleaseWriterLock once for each time you call AcquireWriterLock. Alternatively, you can call ReleaseLock to reduce the lock count to zero immediately.
Recursive lock requests are always granted immediately, without placing the requesting thread in the writer queue.
For valid time-out values, see ReaderWriterLock.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.