RAD Studio VCL Reference
TMultiReadExclusiveWriteSynchronizer Class

TMultiReadExclusiveWriteSynchronizer protects memory in a multi-threaded application.

TMultiReadExclusiveWriteSynchronizer = class(TInterfacedObject, IReadWriteSync);
class TMultiReadExclusiveWriteSynchronizer : public TInterfacedObject, public IReadWriteSync;

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. 


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!