RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TMultiReadExclusiveWriteSynchronizer Class

TMultiReadExclusiveWriteSynchronizer protects memory in a multi-threaded application.

Pascal
TMultiReadExclusiveWriteSynchronizer = class(TInterfacedObject, IReadWriteSync);
C++
class TMultiReadExclusiveWriteSynchronizer : public TInterfacedObject, public IReadWriteSync;

SysUtils

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. 

 

TCriticalSection 

TThread 

Using the Multi-read Exclusive-write Synchronizer

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!