Commit 27d68d8f authored by Max Kellermann's avatar Max Kellermann

output/Internal: move the Mutex to struct AudioOutputControl

struct AudioOutput should not know or care about multi-threading.
parent 546b773b
......@@ -41,8 +41,7 @@ struct notify audio_output_client_notify;
AudioOutputControl::AudioOutputControl(AudioOutput *_output,
AudioOutputClient &_client)
:output(_output), client(_client),
thread(BIND_THIS_METHOD(Task)),
mutex(output->mutex)
thread(BIND_THIS_METHOD(Task))
{
}
......
......@@ -23,6 +23,7 @@
#include "Source.hxx"
#include "AudioFormat.hxx"
#include "thread/Thread.hxx"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "system/PeriodClock.hxx"
#include "Compiler.h"
......@@ -203,7 +204,10 @@ class AudioOutputControl {
bool skip_delay;
public:
Mutex &mutex;
/**
* This mutex protects #open, #fail_timer, #pipe.
*/
mutable Mutex mutex;
AudioOutputControl(AudioOutput *_output, AudioOutputClient &_client);
......
......@@ -22,7 +22,6 @@
#include "AudioFormat.hxx"
#include "filter/Observer.hxx"
#include "thread/Mutex.hxx"
class PreparedFilter;
class MusicPipe;
......@@ -107,11 +106,6 @@ struct AudioOutput {
FilterObserver convert_filter;
/**
* This mutex protects #open, #fail_timer, #pipe.
*/
mutable Mutex mutex;
/**
* Throws #std::runtime_error on error.
*/
AudioOutput(const AudioOutputPlugin &_plugin,
......
......@@ -480,7 +480,7 @@ AudioOutputControl::Task()
if (command == Command::NONE) {
woken_for_play = false;
cond.wait(output->mutex);
cond.wait(mutex);
}
}
}
......
......@@ -26,6 +26,7 @@
#include "mixer/MixerList.hxx"
#include "pcm/PcmExport.hxx"
#include "system/ByteOrder.hxx"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "util/Manual.hxx"
#include "util/RuntimeError.hxx"
......
......@@ -25,6 +25,7 @@
#include "AndroidSimpleBufferQueue.hxx"
#include "../../OutputAPI.hxx"
#include "../../Wrapper.hxx"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "util/Macros.hxx"
#include "util/Domain.hxx"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment