diff options
author | Chris Robinson <[email protected]> | 2018-11-20 23:42:21 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-20 23:42:21 -0800 |
commit | ed06169569193a081b97b7b37cd1a1d3579f5636 (patch) | |
tree | 2247fd892cf15e6160508d0349af007e653d63bb /OpenAL32/alSource.cpp | |
parent | d64d64d4a5d62a90b861ab104fd3b787bfd7256a (diff) |
Use RAII locks with the BackendLock
Diffstat (limited to 'OpenAL32/alSource.cpp')
-rw-r--r-- | OpenAL32/alSource.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp index 56895e77..783a9d82 100644 --- a/OpenAL32/alSource.cpp +++ b/OpenAL32/alSource.cpp @@ -1293,9 +1293,9 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p * clock time with the device latency. Order is important. */ values[0] = GetSourceSecOffset(Source, Context, &srcclock); - almtx_lock(&device->BackendLock); - clocktime = GetClockLatency(device); - almtx_unlock(&device->BackendLock); + { std::lock_guard<almtx_t> _{device->BackendLock}; + clocktime = GetClockLatency(device); + } if(srcclock == (ALuint64)clocktime.ClockTime) values[1] = (ALdouble)clocktime.Latency / 1000000000.0; else @@ -1556,9 +1556,9 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp * clock time with the device latency. Order is important. */ values[0] = GetSourceSampleOffset(Source, Context, &srcclock); - almtx_lock(&device->BackendLock); - clocktime = GetClockLatency(device); - almtx_unlock(&device->BackendLock); + { std::lock_guard<almtx_t> _{device->BackendLock}; + clocktime = GetClockLatency(device); + } if(srcclock == (ALuint64)clocktime.ClockTime) values[1] = clocktime.Latency; else |