[fpc-pascal] TMultiReadExclusiveWriteSynchronizer is wrongly implemented
florian at freepascal.org
Fri Aug 28 10:35:21 CEST 2009
Graeme Geldenhuys schrieb:
> The current TMultiReadExclusiveWriteSynchronizer as implemented in FPC
> 2.3.1 is wrong. It use Critical Sections in a standard way which means
> it blocks all other threads while one thread is doing a Read. This is
> wrong. It is a MULTI read, SINGLE write synchronizer. So it must only
> block other thread is a Write is in progress. But allow multiple reads
> while no Write is in progress.
It is on the safe side but it is not optimal.
> The TMultiReadExclusiveWriteSynchronizer is currently equivalent to the
> Delphi 7 TSimpleRWSync class, not the Delphi
> TMultiReadExclusiveWriteSynchronizer class.
> I have a corrected TMultiReadExclusiveWriteSynchronizer implementation
> (don't worry, not based on Delphi implementation) that I can donate to
> FPC. I just need confirmation that the current implementation in FPC is
> incorrect though.
If you have a better for unix this will be fine. IIRC it is not easy (if
possible after all?) to implement TMultiReadExclusiveWriteSynchronizer
for unix systems.
More information about the fpc-pascal