diff options
author | Chris Robinson <[email protected]> | 2019-10-07 23:22:06 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-10-07 23:22:06 -0700 |
commit | 52a003e9bb7c870f26436b38e62edc96385805dc (patch) | |
tree | 7625ddfd05dc06c62f8870c2f24cd22bdf5ddd68 /alc/backends/wasapi.cpp | |
parent | f0fa6c6baf673a35337d2f2cb5548dd1e33c11e7 (diff) |
Avoid raw lock/unlock calls
Diffstat (limited to 'alc/backends/wasapi.cpp')
-rw-r--r-- | alc/backends/wasapi.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index b6f5b5fb..181518d0 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -689,10 +689,10 @@ FORCE_ALIGN int WasapiPlayback::mixerProc() hr = mRender->GetBuffer(len, &buffer); if(SUCCEEDED(hr)) { - lock(); + std::unique_lock<WasapiPlayback> dlock{*this}; aluMixData(mDevice, buffer, len); mPadding.store(written + len, std::memory_order_relaxed); - unlock(); + dlock.unlock(); hr = mRender->ReleaseBuffer(len, 0); } if(FAILED(hr)) @@ -1136,11 +1136,10 @@ ClockLatency WasapiPlayback::getClockLatency() { ClockLatency ret; - lock(); + std::lock_guard<WasapiPlayback> _{*this}; ret.ClockTime = GetDeviceClockTime(mDevice); ret.Latency = std::chrono::seconds{mPadding.load(std::memory_order_relaxed)}; ret.Latency /= mDevice->Frequency; - unlock(); return ret; } |