[Patch] Re: Ksycoca & QSharedMemory

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Sat Mar 1 15:40:17 GMT 2008


Christian Ehrlicher schrieb:
> Hi,
> 
> To resolve our problems with the open file handle on ksycoca and the resulting problems on windows (file can't be deleted) I would like to use QSharedMemory to share the ksycoca cache.
> Another idea would be to use QFile::map() but this doesn't work on windows too because we can't delete the mapped file (only rename would work) :(
> 
> Therefore I would like to create a simple class derived from QIODevice. It would load (if needed) the file into a QSharedMemory segment. There are two memory segments needed. One with the data and one for status informations.
> When the file content changes, the process needs to call a function update() which increases a counter in the status information shm. After this it informs the other processes via dbus (like it's done now). They reopen their file handle and attach to the new data shm segment. The old shm segment goeas away after the last one detached from it.
> 
> If you don't like the idea for a general usage, I would use it for windows only.
> 
> Comments?
Ok, here the patch.
It introduces a new (currently internal) class KMemFile. This QIODevice 
is then used in ksycoca on windows.

It works fine for me and Ralf Habacker. I also tested it on Linux (not 
tested with kdelibs, only as standalone app).


Comments?
Christian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs.patch
Type: text/x-diff
Size: 14253 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080301/2e3e0b71/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080301/2e3e0b71/attachment.sig>


More information about the kde-core-devel mailing list