mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 08:15:02 -05:00
Switch SQLite3 to SQLITE_CONFIG_MULTITHREAD mode
This commit is contained in:
parent
857e52420e
commit
d2932896a3
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");
|
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user