mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 15:59:23 +01:00
AudioCommon/WASAPI: Use leaner memory model on m_running, no need for a full barrier
This commit is contained in:
parent
ee60be4501
commit
7d59ad262f
@ -45,7 +45,7 @@ WASAPIStream::WASAPIStream()
|
|||||||
|
|
||||||
WASAPIStream::~WASAPIStream()
|
WASAPIStream::~WASAPIStream()
|
||||||
{
|
{
|
||||||
m_running = false;
|
m_running.store(false, std::memory_order_relaxed);
|
||||||
if (m_thread.joinable())
|
if (m_thread.joinable())
|
||||||
m_thread.join();
|
m_thread.join();
|
||||||
}
|
}
|
||||||
@ -327,12 +327,12 @@ bool WASAPIStream::SetRunning(bool running)
|
|||||||
m_audio_renderer = std::move(audio_renderer);
|
m_audio_renderer = std::move(audio_renderer);
|
||||||
m_need_data_event = std::move(need_data_event);
|
m_need_data_event = std::move(need_data_event);
|
||||||
|
|
||||||
m_running = true;
|
m_running.store(true, std::memory_order_relaxed);
|
||||||
m_thread = std::thread([this] { SoundLoop(); });
|
m_thread = std::thread([this] { SoundLoop(); });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_running = false;
|
m_running.store(false, std::memory_order_relaxed);
|
||||||
|
|
||||||
if (m_thread.joinable())
|
if (m_thread.joinable())
|
||||||
m_thread.join();
|
m_thread.join();
|
||||||
@ -356,7 +356,7 @@ void WASAPIStream::SoundLoop()
|
|||||||
m_audio_renderer->ReleaseBuffer(m_frames_in_buffer, AUDCLNT_BUFFERFLAGS_SILENT);
|
m_audio_renderer->ReleaseBuffer(m_frames_in_buffer, AUDCLNT_BUFFERFLAGS_SILENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (m_running)
|
while (m_running.load(std::memory_order_relaxed))
|
||||||
{
|
{
|
||||||
if (!m_audio_renderer)
|
if (!m_audio_renderer)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user