[fpc-pascal] TMultiReadExclusiveWriteSynchronizer is wrongly implemented

Graeme Geldenhuys graemeg at opensoft.homeip.net
Mon Aug 31 09:47:43 CEST 2009

Vinzent Höfler wrote:
> Graeme Geldenhuys <graemeg at opensoft.homeip.net>:
>> I have a corrected TMultiReadExclusiveWriteSynchronizer
>> implementation (don't worry, not based on Delphi implementation)
>> that I can donate to FPC.
> I hope it isn't based on the Delphi one. Last time I heard the Delphi
> implementation suffers from occasional dead locks.

If you read my mail (as quoted above), I clearly stated that it is NOT
based on the Delphi one. After all, I brought to attention the Delphi
similarities in the FPC code a while back - so I would not introduce
copyright code into FPC.

>> I just need confirmation that the current implementation in FPC is 
>> incorrect though.
> It's not incorrect, just inefficient.

I have to disagree. The currently class name is
TMultiReadExclusiveWriteSynchronizer. The currently implementation does
NOT allow multi-read (so the class name totally misleading). It uses a
simple Critical Section to block any other threads while reading or writing.

At least, the FPC team needs to rename the class to TSimpleRWSync (to be
Delphi compatible with the same functionality).

  - Graeme -

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

More information about the fpc-pascal mailing list