diff --git a/extensions/mysql/mysql/MyDatabase.h b/extensions/mysql/mysql/MyDatabase.h index c91d7ad8..37153e47 100644 --- a/extensions/mysql/mysql/MyDatabase.h +++ b/extensions/mysql/mysql/MyDatabase.h @@ -70,7 +70,7 @@ public: const DatabaseInfo &GetInfo(); private: MYSQL *m_mysql; - std::mutex m_FullLock; + std::recursive_mutex m_FullLock; /* ---------- */ DatabaseInfo m_Info; diff --git a/extensions/pgsql/pgsql/PgDatabase.h b/extensions/pgsql/pgsql/PgDatabase.h index b55c415f..908577c4 100644 --- a/extensions/pgsql/pgsql/PgDatabase.h +++ b/extensions/pgsql/pgsql/PgDatabase.h @@ -71,7 +71,7 @@ public: void SetLastIDAndRows(unsigned int insertID, unsigned int affectedRows); private: PGconn *m_pgsql; - std::mutex m_FullLock; + std::recursive_mutex m_FullLock; unsigned int m_lastInsertID; unsigned int m_lastAffectedRows; diff --git a/extensions/sqlite/driver/SqDatabase.h b/extensions/sqlite/driver/SqDatabase.h index 815eab79..ee4d49ac 100644 --- a/extensions/sqlite/driver/SqDatabase.h +++ b/extensions/sqlite/driver/SqDatabase.h @@ -70,7 +70,7 @@ public: } private: sqlite3 *m_sq3; - std::mutex m_FullLock; + std::recursive_mutex m_FullLock; bool m_Persistent; String m_LastError; int m_LastErrorCode; diff --git a/plugins/include/dbi.inc b/plugins/include/dbi.inc index 14af3e44..efdc8eb5 100644 --- a/plugins/include/dbi.inc +++ b/plugins/include/dbi.inc @@ -959,6 +959,10 @@ native bool SQL_Execute(Handle statement); * If the lock cannot be acquired, the main thread will pause until the * threaded operation has concluded. * + * Care should be taken to not lock an already-locked database. Internally, + * lock calls are nested recursively and must be paired with an equal amount + * of unlocks to be undone. This behaviour should not be relied on. + * * @param database A database Handle. * @error Invalid database Handle. */