From bf058f978a51333e3881ad8c046ccc00bff8ef6c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 7 Jan 2009 23:55:13 +0100 Subject: output: join the output thread after sending the KILL command Be sure that the output thread has quite before we start destructing the output object. --- src/output_control.c | 6 +++++- src/output_thread.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/output_control.c b/src/output_control.c index 7f2d8ba8d..503001470 100644 --- a/src/output_control.c +++ b/src/output_control.c @@ -134,8 +134,12 @@ void audio_output_close(struct audio_output *audioOutput) void audio_output_finish(struct audio_output *audioOutput) { audio_output_close(audioOutput); - if (audioOutput->thread != NULL) + + if (audioOutput->thread != NULL) { ao_command(audioOutput, AO_COMMAND_KILL); + g_thread_join(audioOutput->thread); + } + if (audioOutput->plugin->finish) audioOutput->plugin->finish(audioOutput->data); if (audioOutput->convBuffer) diff --git a/src/output_thread.c b/src/output_thread.c index 1467d26a8..3d5fe57d6 100644 --- a/src/output_thread.c +++ b/src/output_thread.c @@ -175,6 +175,6 @@ void audio_output_thread_start(struct audio_output *ao) assert(ao->command == AO_COMMAND_NONE); - if (!(ao->thread = g_thread_create(audio_output_task, ao, FALSE, &e))) + if (!(ao->thread = g_thread_create(audio_output_task, ao, true, &e))) g_error("Failed to spawn output task: %s\n", e->message); } -- cgit v1.2.3