[fpc-devel] Rather large flaw in TJSONConfig component
Henry Vermaak
henry.vermaak at gmail.com
Mon Jun 21 16:29:01 CEST 2010
On 21 June 2010 15:10, Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:
> Op 2010-06-21 15:34, Henry Vermaak het geskryf:
>>
>> Seriously, would you try the same thing with a file?
>
> Seriously, you would want to tell developers in todays times that they
> can't concurrently access a file?
No, that's not what I'm saying. You need to make it work. Your
complaint is like saying the write syscall doesn't do the right thing
when I use it on the same file from two different places. It _can_
work, but it's your job to do it correctly.
>> Programs that want to write to the same json file from
>> different classes need to handle this properly, just like they would
>> have to when using files.
>
> Unfortunately TJSONConfig and TXMLConfig encapsulates the file handling -
> it's not available to the developer to change. So the file handling fix
> needs to occur in these components themselves.
You can create a class that wraps all the json operations, and
therefore handle concurrency in one place. You're only using one json
file after all.
Henry
More information about the fpc-devel
mailing list