diff options
Diffstat (limited to 'src/PlayerThread.cxx')
-rw-r--r-- | src/PlayerThread.cxx | 21 |
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); } |