Use SQLITE_OPEN_NOMUTEX

C++20
elsid 3 years ago
parent a7e76c6f3d
commit 5913036638
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -16,7 +16,10 @@ namespace Sqlite3
Db makeDb(std::string_view path, const char* schema)
{
sqlite3* handle = nullptr;
const int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
// All uses of NavMeshDb are protected by a mutex (navmeshtool) or serialized in a single thread (DbWorker)
// so additional synchronization between threads is not required and SQLITE_OPEN_NOMUTEX can be used.
// This is unsafe to use NavMeshDb without external synchronization because of internal state.
const int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX;
if (const int ec = sqlite3_open_v2(std::string(path).c_str(), &handle, flags, nullptr); ec != SQLITE_OK)
{
const std::string message(sqlite3_errmsg(handle));

Loading…
Cancel
Save