On Sun, 2004-02-15 at 23:16, Andreas Bombe wrote: > I want to get that sorted out. The database really should be saved to > disk on every change immediately (including rating changes). The biggest problem with this is larger libraries - it can take as long as 5 seconds to save here with 20000 songs; the XML file is over 10 megs. Doing that much I/O every time the user wants to rate a song is a bit much. > Not aware of all the possible pitfalls, I just implemented a naive > scheme where a rhythmdb_save() is performed on every > rhythmdb_write_unlock(). Yes, I hooked it to the rw lock, to catch all > changes. I also added rhythmdb_inhibit_syncs() and > rhythmdb_permit_syncs() to prevent saving on every step of a long chain > of write accesses. I think it would be easier to just have a thread which sits around and checks whether the db is dirty or not, and if it is, saves it. You could do this just with a boolean and a mutex/condition pair inside rhythmdb.c, and another thread dedicated to saving. That way you wouldn't have to change code elsewhere in rb.
This is a digitally signed message part