System.SysUtils.TMultiReadExclusiveWriteSynchronizer
Delphi
TMultiReadExclusiveWriteSynchronizer = class(TInterfacedObject, IReadWriteSync)
C++
class PASCALIMPLEMENTATION TMultiReadExclusiveWriteSynchronizer : public System::TInterfacedObject
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
class | public | System.SysUtils.pas System.SysUtils.hpp |
System.SysUtils | System.SysUtils |
Description
TMultiReadExclusiveWriteSynchronizer protects memory in a multi-threaded application.
Use TMultiReadExclusiveWriteSynchronizer to guard access to memory in a multi-threaded application. Unlike a critical section, which blocks all other threads from reading or writing its associated memory, TMultiReadExclusiveWriteSynchronizer allows multiple threads to read from the protected memory simultaneously, while ensuring that any thread writing to the memory has exclusive access.
In applications where threads read from an object or variable frequently and only write to it occasionally, using the multi-read exclusive-write synchronizer instead of a critical section can result in considerable performance improvement.
All access to the protected memory must be bracketed by calls to the BeginRead and EndRead or BeginWrite and EndWrite methods. Any thread that reads from or writes to this memory without using these calls can introduce thread conflicts.