From d2932896a3c87ebce8cfb0a0508181134c06f673 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Mon, 26 Apr 2010 18:24:09 +0200 Subject: [PATCH] Switch SQLite3 to SQLITE_CONFIG_MULTITHREAD mode --- src/db.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/db.c b/src/db.c index 425f8567..6b76840e 100644 --- a/src/db.c +++ b/src/db.c @@ -3931,6 +3931,14 @@ db_init(void) db_path = cfg_getstr(cfg_getsec(cfg, "general"), "db_path"); + ret = sqlite3_config(SQLITE_CONFIG_MULTITHREAD); + if (ret != SQLITE_OK) + { + DPRINTF(E_FATAL, L_DB, "Could not switch SQLite3 to multithread mode\n"); + DPRINTF(E_FATAL, L_DB, "Check that SQLite3 has been configured for thread-safe operations\n"); + return -1; + } + ret = sqlite3_initialize(); if (ret != SQLITE_OK) { @@ -3938,12 +3946,6 @@ db_init(void) return -1; } - if (!sqlite3_threadsafe()) - { - DPRINTF(E_FATAL, L_DB, "The SQLite3 library is not built with a threadsafe configuration\n"); - return -1; - } - ret = db_perthread_init(); if (ret < 0) return ret;