This is preliminary documentation and subject to change. To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
ReaderWriterLock Class
Defines the lock that implements single-writer/ multiple-reader semantics that supports the following features:
Cheap enough to be used in large numbers such as per object synchronization.
Supports timeout. This is a valuable feature to detect deadlocks.
Supports caching of events. This allows the events to be moved from least contentious regions to the most contentious regions. In other words, the number of events needed by Reader-Writer locks is bounded by the number of threads in the process.
Supports nested locks by readers and writers.
Supports spin counts for avoiding context switches on multi processor machines.
Supports functionality for upgrading to a writer lock with a return argument that indicates intermediate writes. Downgrading from a writer lock restores the state of the lock.
Supports functionality to Release Lock for calling app code. RestoreLock restores the lock state and indicates intermediate writes.
Recovers from most common failures such as creation of events. In other words, the lock maintains consistent internal state and remains usable.
[Visual Basic]
NotInheritable Public Class ReaderWriterLock
[C#]
public sealed class ReaderWriterLock
[C++]
public __gc __sealed class ReaderWriterLock
[JScript]
public class ReaderWriterLock
Remarks
Negative numbers are interpreted as unsigned, with the exception of-1, which has special meaning.