From ef5cf40fa6d3e2f50ad916be8e5bd99affe7d2e3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 31 Jan 2012 22:12:14 +0100 Subject: directory: require the caller to lock the db_mutex Reduce the number of lock/unlock cycles, and make database handling safer. --- src/db_save.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/db_save.c') diff --git a/src/db_save.c b/src/db_save.c index 00967f4f2..4af9d58b8 100644 --- a/src/db_save.c +++ b/src/db_save.c @@ -19,6 +19,7 @@ #include "config.h" #include "db_save.h" +#include "db_lock.h" #include "directory.h" #include "directory_save.h" #include "song.h" @@ -169,7 +170,9 @@ db_load_internal(FILE *fp, struct directory *music_root, GError **error) g_debug("reading DB"); + db_lock(); success = directory_load(fp, music_root, buffer, error); + db_unlock(); g_string_free(buffer, true); return success; -- cgit v1.2.3