summaryrefslogtreecommitdiff
path: root/src/DatabaseLock.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/DatabaseLock.hxx')
-rw-r--r--src/DatabaseLock.hxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/DatabaseLock.hxx b/src/DatabaseLock.hxx
index ba6157999..005835549 100644
--- a/src/DatabaseLock.hxx
+++ b/src/DatabaseLock.hxx
@@ -30,14 +30,15 @@
#include "thread/Mutex.hxx"
#include "gcc.h"
-#include <glib.h>
#include <assert.h>
extern Mutex db_mutex;
#ifndef NDEBUG
-extern GThread *db_mutex_holder;
+#include "thread/Id.hxx"
+
+extern ThreadId db_mutex_holder;
/**
* Does the current thread hold the database lock?
@@ -46,7 +47,7 @@ gcc_pure
static inline bool
holding_db_lock(void)
{
- return db_mutex_holder == g_thread_self();
+ return db_mutex_holder.IsInside();
}
#endif
@@ -62,9 +63,9 @@ db_lock(void)
db_mutex.lock();
- assert(db_mutex_holder == NULL);
+ assert(db_mutex_holder.IsNull());
#ifndef NDEBUG
- db_mutex_holder = g_thread_self();
+ db_mutex_holder = ThreadId::GetCurrent();
#endif
}
@@ -76,7 +77,7 @@ db_unlock(void)
{
assert(holding_db_lock());
#ifndef NDEBUG
- db_mutex_holder = NULL;
+ db_mutex_holder = ThreadId::Null();
#endif
db_mutex.unlock();