Commit 48025c22 authored by Max Kellermann's avatar Max Kellermann

DatabaseLock: use the Mutex class instead of GLib's GMutex

parent a68302e5
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#pragma GCC diagnostic ignored "-Wmissing-field-initializers" #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif #endif
GStaticMutex db_mutex = G_STATIC_MUTEX_INIT; Mutex db_mutex;
#ifndef NDEBUG #ifndef NDEBUG
GThread *db_mutex_holder; GThread *db_mutex_holder;
......
...@@ -27,11 +27,12 @@ ...@@ -27,11 +27,12 @@
#define MPD_DB_LOCK_HXX #define MPD_DB_LOCK_HXX
#include "check.h" #include "check.h"
#include "thread/Mutex.hxx"
#include <glib.h> #include <glib.h>
#include <assert.h> #include <assert.h>
extern GStaticMutex db_mutex; extern Mutex db_mutex;
#ifndef NDEBUG #ifndef NDEBUG
...@@ -58,7 +59,7 @@ db_lock(void) ...@@ -58,7 +59,7 @@ db_lock(void)
{ {
assert(!holding_db_lock()); assert(!holding_db_lock());
g_static_mutex_lock(&db_mutex); db_mutex.lock();
assert(db_mutex_holder == NULL); assert(db_mutex_holder == NULL);
#ifndef NDEBUG #ifndef NDEBUG
...@@ -77,7 +78,7 @@ db_unlock(void) ...@@ -77,7 +78,7 @@ db_unlock(void)
db_mutex_holder = NULL; db_mutex_holder = NULL;
#endif #endif
g_static_mutex_unlock(&db_mutex); db_mutex.unlock();
} }
#ifdef __cplusplus #ifdef __cplusplus
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment