aboutsummaryrefslogtreecommitdiffstats
path: root/src/PlayerThread.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-17 18:42:14 +0200
committerMax Kellermann <max@duempel.org>2013-10-17 19:29:47 +0200
commit8e676db633aa8888c8408a91ef219d2261ef42e2 (patch)
tree9e61e37ab5d181e90e89c5d4ced99c3434b3976c /src/PlayerThread.cxx
parentf6d74012b7a583bddf2e3b824193ade91fe09ce7 (diff)
downloadmpd-8e676db633aa8888c8408a91ef219d2261ef42e2.tar.gz
mpd-8e676db633aa8888c8408a91ef219d2261ef42e2.tar.xz
mpd-8e676db633aa8888c8408a91ef219d2261ef42e2.zip
Thread/Thread: replacement library for GThread
Diffstat (limited to '')
-rw-r--r--src/PlayerThread.cxx21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx
index 94cfe2af1..6e5231052 100644
--- a/src/PlayerThread.cxx
+++ b/src/PlayerThread.cxx
@@ -1096,8 +1096,8 @@ do_play(player_control &pc, decoder_control &dc,
player.Run();
}
-static gpointer
-player_task(gpointer arg)
+static void
+player_task(void *arg)
{
player_control &pc = *(player_control *)arg;
@@ -1163,7 +1163,7 @@ player_task(gpointer arg)
audio_output_all_close();
player_command_finished(pc);
- return nullptr;
+ return;
case PlayerCommand::CANCEL:
if (pc.next_song != nullptr) {
@@ -1189,14 +1189,9 @@ player_task(gpointer arg)
void
player_create(player_control &pc)
{
- assert(pc.thread == nullptr);
-
-#if GLIB_CHECK_VERSION(2,32,0)
- pc.thread = g_thread_new("player", player_task, &pc);
-#else
- GError *e = nullptr;
- pc.thread = g_thread_create(player_task, &pc, true, &e);
- if (pc.thread == nullptr)
- FatalError("Failed to spawn player task", e);
-#endif
+ assert(!pc.thread.IsDefined());
+
+ Error error;
+ if (!pc.thread.Start(player_task, &pc, error))
+ FatalError(error);
}