[fpc-devel] Rather large flaw in TJSONConfig component

Henry Vermaak henry.vermaak at gmail.com
Tue Jun 22 12:05:25 CEST 2010


On 22/06/10 10:29, Graeme Geldenhuys wrote:
> Op 2010-06-22 11:17, Henry Vermaak het geskryf:
>>>
>>> My point is that this is the wrong place to build such functionality
>>> in.  How do you propose this should work from different files or
>>> processes?
>>
>> s/files/threads
>
> In tiOPF we have a Singleton for INI file processing. It uses the
> TMultiReadExclusiveWriteSynchronizer class no manage access, and it is
> thread-safe.

Yes, I've done this before, too (in delphi, though).  If you add this to 
the TJSONConfig class, you'll have to keep track of which files are 
opened by different TJSONConfig classes, then lock them accordingly. 
This complicates things unnecessarily for a small amount of use cases. 
I can see how a derived thread-safe class would be handy for some 
people, but I'd implement this in my app, personally.  Much simpler.

Henry



More information about the fpc-devel mailing list