[Patch] Re: Ksycoca & QSharedMemory

Ralf Habacker ralf.habacker at freenet.de
Mon Mar 3 09:06:43 GMT 2008


Christian Ehrlicher schrieb:
> 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?
seems no one objects, feel free to commit .

Ralf





More information about the kde-core-devel mailing list