aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/jack.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/jack.cpp
parentf0fa6c6baf673a35337d2f2cb5548dd1e33c11e7 (diff)
Avoid raw lock/unlock calls
Diffstat (limited to 'alc/backends/jack.cpp')
-rw-r--r--alc/backends/jack.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp
index c7e2839c..7c3f1822 100644
--- a/alc/backends/jack.cpp
+++ b/alc/backends/jack.cpp
@@ -296,15 +296,15 @@ int JackPlayback::mixerProc()
SetRTPriority();
althrd_setname(MIXER_THREAD_NAME);
- lock();
+ std::unique_lock<JackPlayback> dlock{*this};
while(!mKillNow.load(std::memory_order_acquire) &&
mDevice->Connected.load(std::memory_order_acquire))
{
if(mRing->writeSpace() < mDevice->UpdateSize)
{
- unlock();
+ dlock.unlock();
mSem.wait();
- lock();
+ dlock.lock();
continue;
}
@@ -320,7 +320,6 @@ int JackPlayback::mixerProc()
aluMixData(mDevice, data.second.buf, len2);
mRing->writeAdvance(todo);
}
- unlock();
return 0;
}
@@ -484,11 +483,10 @@ ClockLatency JackPlayback::getClockLatency()
{
ClockLatency ret;
- lock();
+ std::lock_guard<JackPlayback> _{*this};
ret.ClockTime = GetDeviceClockTime(mDevice);
ret.Latency = std::chrono::seconds{mRing->readSpace()};
ret.Latency /= mDevice->Frequency;
- unlock();
return ret;
}