From 32dfc11c23ec89a994ec92a98e2f9a5c0fbd93db Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 17 Oct 2013 19:27:02 +0200 Subject: Main: use ThreadId instead of GThread* --- src/Main.cxx | 5 +++-- src/Main.hxx | 4 ++-- src/UpdateGlue.cxx | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Main.cxx b/src/Main.cxx index 003f7414b..726bfc5d4 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -58,6 +58,7 @@ #include "system/FatalError.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" +#include "thread/Id.hxx" #include "ConfigGlobal.hxx" #include "ConfigData.hxx" #include "ConfigDefaults.hxx" @@ -99,7 +100,7 @@ enum { static constexpr Domain main_domain("main"); -GThread *main_task; +ThreadId main_thread; EventLoop *main_loop; Instance *instance; @@ -389,7 +390,7 @@ int mpd_main(int argc, char *argv[]) return EXIT_FAILURE; } - main_task = g_thread_self(); + main_thread = ThreadId::GetCurrent(); main_loop = new EventLoop(EventLoop::Default()); instance = new Instance(); diff --git a/src/Main.hxx b/src/Main.hxx index a789300ed..943d9819e 100644 --- a/src/Main.hxx +++ b/src/Main.hxx @@ -20,11 +20,11 @@ #ifndef MPD_MAIN_HXX #define MPD_MAIN_HXX +class ThreadId; class EventLoop; struct Instance; -typedef struct _GThread GThread; -extern GThread *main_task; +extern ThreadId main_thread; extern EventLoop *main_loop; diff --git a/src/UpdateGlue.cxx b/src/UpdateGlue.cxx index 50af6271d..e55668c55 100644 --- a/src/UpdateGlue.cxx +++ b/src/UpdateGlue.cxx @@ -33,6 +33,7 @@ #include "Main.hxx" #include "Instance.hxx" #include "system/FatalError.hxx" +#include "thread/Id.hxx" #include @@ -92,7 +93,7 @@ static void * update_task(void *_path) static void spawn_update_task(const char *path) { - assert(g_thread_self() == main_task); + assert(main_thread.IsInside()); progress = UPDATE_PROGRESS_RUNNING; modified = false; @@ -115,7 +116,7 @@ spawn_update_task(const char *path) unsigned update_enqueue(const char *path, bool _discard) { - assert(g_thread_self() == main_task); + assert(main_thread.IsInside()); if (!db_is_simple() || !mapper_has_music_directory()) return 0; -- cgit v1.2.3