decoder/Thread: move decoder_thread_start() into DecoderControl

This commit is contained in:
Max Kellermann
2018-09-21 16:57:54 +02:00
parent af64bd5088
commit 218d9383d7
5 changed files with 10 additions and 41 deletions

View File

@@ -178,6 +178,14 @@ struct DecoderControl final : InputStreamHandler {
const ReplayGainConfig &_replay_gain_config) noexcept;
~DecoderControl() noexcept;
/**
* Throws on error.
*/
void StartThread() {
quit = false;
thread.Start();
}
/**
* Locks the object.
*/

View File

@@ -18,7 +18,6 @@
*/
#include "config.h"
#include "DecoderThread.hxx"
#include "DecoderControl.hxx"
#include "Bridge.hxx"
#include "DecoderError.hxx"
@@ -565,12 +564,3 @@ DecoderControl::RunThread() noexcept
}
} while (command != DecoderCommand::NONE || !quit);
}
void
decoder_thread_start(DecoderControl &dc)
{
assert(!dc.thread.IsDefined());
dc.quit = false;
dc.thread.Start();
}

View File

@@ -1,28 +0,0 @@
/*
* Copyright 2003-2017 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_DECODER_THREAD_HXX
#define MPD_DECODER_THREAD_HXX
struct DecoderControl;
void
decoder_thread_start(DecoderControl &dc);
#endif