Switch SQLite3 to SQLITE_CONFIG_MULTITHREAD mode

This commit is contained in:
Julien BLACHE 2010-04-26 18:24:09 +02:00
parent 857e52420e
commit d2932896a3

View File

@ -3931,6 +3931,14 @@ db_init(void)
db_path = cfg_getstr(cfg_getsec(cfg, "general"), "db_path"); 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(); ret = sqlite3_initialize();
if (ret != SQLITE_OK) if (ret != SQLITE_OK)
{ {
@ -3938,12 +3946,6 @@ db_init(void)
return -1; 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(); ret = db_perthread_init();
if (ret < 0) if (ret < 0)
return ret; return ret;