[fpc-pascal] TMultiReadExclusiveWriteSynchronizer is wrongly implemented

Graeme Geldenhuys graemeg at opensoft.homeip.net
Fri Aug 28 10:25:38 CEST 2009


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.

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.

  - Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

More information about the fpc-pascal mailing list