From d23c907a94a58d5e6ad2f42f6eecf358e3d9f775 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 10 Aug 2013 09:00:04 +0200 Subject: thread/Id: new class replacing GThread pointers Remove a GLib dependencies from class EventLoop and DatabaseLock. --- src/DatabaseLock.hxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/DatabaseLock.hxx') 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 #include 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(); -- cgit v1.2.3