aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/opensl.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-10-07 23:22:06 -0700
committerChris Robinson <[email protected]>2019-10-07 23:22:06 -0700
commit52a003e9bb7c870f26436b38e62edc96385805dc (patch)
tree7625ddfd05dc06c62f8870c2f24cd22bdf5ddd68 /alc/backends/opensl.cpp
parentf0fa6c6baf673a35337d2f2cb5548dd1e33c11e7 (diff)
Avoid raw lock/unlock calls
Diffstat (limited to 'alc/backends/opensl.cpp')
-rw-r--r--alc/backends/opensl.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp
index 4e4ceb5b..f546f168 100644
--- a/alc/backends/opensl.cpp
+++ b/alc/backends/opensl.cpp
@@ -228,7 +228,7 @@ int OpenSLPlayback::mixerProc()
PRINTERR(result, "bufferQueue->GetInterface SL_IID_PLAY");
}
- lock();
+ std::unique_lock<OpenSLPlayback> dlock{*this};
if(SL_RESULT_SUCCESS != result)
aluHandleDisconnect(mDevice, "Failed to get playback buffer: 0x%08x", result);
@@ -254,9 +254,9 @@ int OpenSLPlayback::mixerProc()
if(mRing->writeSpace() == 0)
{
- unlock();
+ dlock.unlock();
mSem.wait();
- lock();
+ dlock.lock();
continue;
}
}
@@ -292,7 +292,6 @@ int OpenSLPlayback::mixerProc()
data.first.buf += mDevice->UpdateSize*mFrameSize;
}
}
- unlock();
return 0;
}
@@ -617,11 +616,10 @@ ClockLatency OpenSLPlayback::getClockLatency()
{
ClockLatency ret;
- lock();
+ std::lock_guard<OpenSLPlayback> _{*this};
ret.ClockTime = GetDeviceClockTime(mDevice);
ret.Latency = std::chrono::seconds{mRing->readSpace() * mDevice->UpdateSize};
ret.Latency /= mDevice->Frequency;
- unlock();
return ret;
}