KConfig/KLockFile performance (was KMimeType performance)

Lubos Lunak l.lunak at suse.cz
Tue Oct 9 20:49:45 BST 2007


On Tuesday 09 of October 2007, Thiago Macieira wrote:
> David Faure wrote:
> >On Tuesday 09 October 2007, Maksim Orlovich wrote:
> >> KDesktopFile/KConfig tries to lock the file with KLockFile
> >
> >Huh. I thought we got rid of the "bool readonly" because it made no
> > behavior difference, but if KConfig locks the file then surely we need
> > a "ReadOnly" flag again? Or better: we should lock at the time of
> > writing to the file, not when just reading from it!
>
> That depends on how the writing is done.
>
> Is it done via write-to-new-file + rename? If so, then there's no problem
> locking only on write[1].

 Then probably there's no locking needed at all. Why? The race condition when 
there would be two apps writing is there anyway and I don't see any other 
problem.

> On the other hand, if we're writing to the file that is being read, this
> can introduce problems. So the lock must be for both reading and writing.
>
> [1] AFAIK, you can't rename or delete a file that is open and/or in use on
> Windows. In other words, locking is mandatory and implemented by the
> platform.

-- 
Lubos Lunak
KDE developer
--------------------------------------------------------------
SUSE LINUX, s.r.o.   e-mail: l.lunak at suse.cz , l.lunak at kde.org
Lihovarska 1060/12   tel: +420 284 028 972
190 00 Prague 9      fax: +420 284 028 951
Czech Republic       http//www.suse.cz




More information about the kde-core-devel mailing list