diff options
author | Chris Robinson <[email protected]> | 2018-12-30 21:58:14 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-30 21:58:14 -0800 |
commit | 5e03941701c112083b5dce14257fd8c51262f04f (patch) | |
tree | e60fe1ba85f1d42e0f2b574360713842769df135 /Alc/backends/oss.cpp | |
parent | 9f5c9a2260849240bd680b8fdf533acdef7f9de1 (diff) |
Use an atomic bool on things that only take true or false
Diffstat (limited to 'Alc/backends/oss.cpp')
-rw-r--r-- | Alc/backends/oss.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Alc/backends/oss.cpp b/Alc/backends/oss.cpp index b5640ae3..05394f34 100644 --- a/Alc/backends/oss.cpp +++ b/Alc/backends/oss.cpp @@ -257,7 +257,7 @@ struct OSSPlayback final : public BackendBase { al::vector<ALubyte> mMixData; - std::atomic<ALenum> mKillNow{AL_TRUE}; + std::atomic<bool> mKillNow{true}; std::thread mThread; static constexpr inline const char *CurrentPrefix() noexcept { return "OSSPlayback::"; } @@ -448,7 +448,7 @@ ALCboolean OSSPlayback::reset() ALCboolean OSSPlayback::start() { try { - mKillNow.store(AL_FALSE); + mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&OSSPlayback::mixerProc), this}; return ALC_TRUE; } @@ -462,7 +462,7 @@ ALCboolean OSSPlayback::start() void OSSPlayback::stop() { - if(mKillNow.exchange(AL_TRUE) || !mThread.joinable()) + if(mKillNow.exchange(true, std::memory_order_acq_rel) || !mThread.joinable()) return; mThread.join(); @@ -487,7 +487,7 @@ struct OSScapture final : public BackendBase { RingBufferPtr mRing{nullptr}; - std::atomic<ALenum> mKillNow{AL_TRUE}; + std::atomic<bool> mKillNow{true}; std::thread mThread; static constexpr inline const char *CurrentPrefix() noexcept { return "OSScapture::"; } @@ -661,7 +661,7 @@ ALCenum OSScapture::open(const ALCchar *name) ALCboolean OSScapture::start() { try { - mKillNow.store(AL_FALSE); + mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&OSScapture::recordProc), this}; return ALC_TRUE; } @@ -675,7 +675,7 @@ ALCboolean OSScapture::start() void OSScapture::stop() { - if(mKillNow.exchange(AL_TRUE) || !mThread.joinable()) + if(mKillNow.exchange(true, std::memory_order_acq_rel) || !mThread.joinable()) return; mThread.join(); |