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/winmm.cpp | |
parent | f0fa6c6baf673a35337d2f2cb5548dd1e33c11e7 (diff) |
Avoid raw lock/unlock calls
Diffstat (limited to 'alc/backends/winmm.cpp')
-rw-r--r-- | alc/backends/winmm.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/alc/backends/winmm.cpp b/alc/backends/winmm.cpp index c287e136..8f85f351 100644 --- a/alc/backends/winmm.cpp +++ b/alc/backends/winmm.cpp @@ -183,16 +183,16 @@ FORCE_ALIGN int WinMMPlayback::mixerProc() SetRTPriority(); althrd_setname(MIXER_THREAD_NAME); - lock(); + std::unique_lock<WinMMPlayback> dlock{*this}; while(!mKillNow.load(std::memory_order_acquire) && mDevice->Connected.load(std::memory_order_acquire)) { ALsizei todo = mWritable.load(std::memory_order_acquire); if(todo < 1) { - unlock(); + dlock.unlock(); mSem.wait(); - lock(); + dlock.lock(); continue; } @@ -207,7 +207,6 @@ FORCE_ALIGN int WinMMPlayback::mixerProc() } while(--todo); mIdx = static_cast<ALuint>(widx); } - unlock(); return 0; } @@ -427,16 +426,16 @@ int WinMMCapture::captureProc() { althrd_setname(RECORD_THREAD_NAME); - lock(); + std::unique_lock<WinMMCapture> dlock{*this}; while(!mKillNow.load(std::memory_order_acquire) && mDevice->Connected.load(std::memory_order_acquire)) { ALuint todo{mReadable.load(std::memory_order_acquire)}; if(todo < 1) { - unlock(); + dlock.unlock(); mSem.wait(); - lock(); + dlock.lock(); continue; } @@ -451,7 +450,6 @@ int WinMMCapture::captureProc() } while(--todo); mIdx = static_cast<ALuint>(widx); } - unlock(); return 0; } |