From RAD Studio API Documentation
Jump to: navigation, search



TMultiReadExclusiveWriteSynchronizer = class(TInterfacedObject, IReadWriteSync)


class PASCALIMPLEMENTATION TMultiReadExclusiveWriteSynchronizer : public System::TInterfacedObject


Type Visibility Source Unit Parent
class public
System.SysUtils System.SysUtils


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.

See Also