Thread/Thread: replacement library for GThread

This commit is contained in:
Max Kellermann
2013-10-17 18:42:14 +02:00
parent f6d74012b7
commit 8e676db633
21 changed files with 309 additions and 97 deletions

View File

@@ -23,6 +23,8 @@
#include "Song.hxx"
#include "DecoderControl.hxx"
#include <glib.h>
#include <cmath>
#include <assert.h>
@@ -31,7 +33,6 @@ player_control::player_control(unsigned _buffer_chunks,
unsigned _buffered_before_play)
:buffer_chunks(_buffer_chunks),
buffered_before_play(_buffered_before_play),
thread(nullptr),
command(PlayerCommand::NONE),
state(PlayerState::STOP),
error_type(PlayerError::NONE),
@@ -100,11 +101,10 @@ player_control::UpdateAudio()
void
player_control::Kill()
{
assert(thread != NULL);
assert(thread.IsDefined());
LockSynchronousCommand(PlayerCommand::EXIT);
g_thread_join(thread);
thread = NULL;
thread.Join();
idle_add(IDLE_PLAYER);
}