diff options
| author | Lioncash <mathew1800@gmail.com> | 2015-05-10 00:20:27 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2015-05-11 01:55:59 -0400 |
| commit | 353205132c6fa5da8edbe1a4097cef2fad872794 (patch) | |
| tree | ab51078c8f4b444022ffc2d6257537eb198dfa73 /Source/Core/AudioCommon/AlsaSoundStream.cpp | |
| parent | 7b376abd3bd59eeeeddb3cdb6f0000e8c901ba1e (diff) | |
AlsaSoundStream: Convert volatile variables to atomics
Diffstat (limited to 'Source/Core/AudioCommon/AlsaSoundStream.cpp')
| -rw-r--r-- | Source/Core/AudioCommon/AlsaSoundStream.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/Core/AudioCommon/AlsaSoundStream.cpp b/Source/Core/AudioCommon/AlsaSoundStream.cpp index 5f76c60de7..099a3dee35 100644 --- a/Source/Core/AudioCommon/AlsaSoundStream.cpp +++ b/Source/Core/AudioCommon/AlsaSoundStream.cpp @@ -23,13 +23,13 @@ AlsaSound::~AlsaSound() bool AlsaSound::Start() { thread = std::thread(&AlsaSound::SoundLoop, this); - thread_data = 0; + thread_data.store(0); return true; } void AlsaSound::Stop() { - thread_data = 1; + thread_data.store(1); thread.join(); } @@ -42,11 +42,11 @@ void AlsaSound::Update() void AlsaSound::SoundLoop() { if (!AlsaInit()) { - thread_data = 2; + thread_data.store(2); return; } Common::SetCurrentThreadName("Audio thread - alsa"); - while (!thread_data) + while (thread_data.load() == 0) { m_mixer->Mix(reinterpret_cast<short *>(mix_buffer), frames_to_deliver); int rc = m_muted ? 1337 : snd_pcm_writei(handle, mix_buffer, frames_to_deliver); @@ -61,7 +61,7 @@ void AlsaSound::SoundLoop() } } AlsaShutdown(); - thread_data = 2; + thread_data.store(2); } bool AlsaSound::AlsaInit() |
