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/dsound.cpp | |
parent | f0fa6c6baf673a35337d2f2cb5548dd1e33c11e7 (diff) |
Avoid raw lock/unlock calls
Diffstat (limited to 'alc/backends/dsound.cpp')
-rw-r--r-- | alc/backends/dsound.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp index 19a3c604..d48b74e2 100644 --- a/alc/backends/dsound.cpp +++ b/alc/backends/dsound.cpp @@ -276,17 +276,18 @@ FORCE_ALIGN int DSoundPlayback::mixerProc() if(SUCCEEDED(err)) { - lock(); + std::unique_lock<DSoundPlayback> dlock{*this}; aluMixData(mDevice, WritePtr1, WriteCnt1/FrameSize); if(WriteCnt2 > 0) aluMixData(mDevice, WritePtr2, WriteCnt2/FrameSize); - unlock(); + dlock.unlock(); mBuffer->Unlock(WritePtr1, WriteCnt1, WritePtr2, WriteCnt2); } else { ERR("Buffer lock error: %#lx\n", err); + std::lock_guard<DSoundPlayback> _{*this}; aluHandleDisconnect(mDevice, "Failed to lock output buffer: 0x%lx", err); return 1; } |