Use Common::Flag and Common::Event when possible

Replaces old and simple usages of std::atomic<bool> with Common::Flag
(which was introduced after the initial usage), so it's clear that
the variable is a flag and because Common::Flag is well tested.

This also replaces the ready logic in WiimoteReal with Common::Event
since it was basically just unnecessarily reimplementing Common::Event.
This commit is contained in:
Léo Lam
2016-08-05 16:04:39 +02:00
parent c6a0e543a5
commit dca22e08eb
19 changed files with 94 additions and 132 deletions

View File

@ -8,10 +8,9 @@
#include <pulse/pulseaudio.h>
#endif
#include <atomic>
#include "AudioCommon/SoundStream.h"
#include "Common/CommonTypes.h"
#include "Common/Flag.h"
#include "Common/Thread.h"
class PulseAudio final : public SoundStream
@ -41,7 +40,7 @@ private:
static void UnderflowCallback(pa_stream* s, void* userdata);
std::thread m_thread;
std::atomic<bool> m_run_thread;
Common::Flag m_run_thread;
bool m_stereo; // stereo, else surround
int m_bytespersample;