mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-08 21:24:57 -05:00
Switch SQLite3 to SQLITE_CONFIG_MULTITHREAD mode
This commit is contained in:
14
src/db.c
14
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;
|
||||
|
||||
Reference in New Issue
Block a user