aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-30 21:58:14 -0800
committerChris Robinson <[email protected]>2018-12-30 21:58:14 -0800
commit5e03941701c112083b5dce14257fd8c51262f04f (patch)
treee60fe1ba85f1d42e0f2b574360713842769df135 /Alc/backends
parent9f5c9a2260849240bd680b8fdf533acdef7f9de1 (diff)
Use an atomic bool on things that only take true or false
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/alsa.cpp6
-rw-r--r--Alc/backends/dsound.cpp6
-rw-r--r--Alc/backends/null.cpp6
-rw-r--r--Alc/backends/opensl.cpp6
-rw-r--r--Alc/backends/oss.cpp12
-rw-r--r--Alc/backends/wasapi.cpp12
-rw-r--r--Alc/backends/wave.cpp6
-rw-r--r--Alc/backends/winmm.cpp12
8 files changed, 33 insertions, 33 deletions
diff --git a/Alc/backends/alsa.cpp b/Alc/backends/alsa.cpp
index a3c30732..aee9c1d3 100644
--- a/Alc/backends/alsa.cpp
+++ b/Alc/backends/alsa.cpp
@@ -441,7 +441,7 @@ struct AlsaPlayback final : public BackendBase {
al::vector<char> mBuffer;
- std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::atomic<bool> mKillNow{true};
std::thread mThread;
static constexpr inline const char *CurrentPrefix() noexcept { return "AlsaPlayback::"; }
@@ -856,7 +856,7 @@ ALCboolean AlsaPlayback::start()
}
try {
- mKillNow.store(AL_FALSE, std::memory_order_release);
+ mKillNow.store(false, std::memory_order_release);
mThread = std::thread{std::mem_fn(thread_func), this};
return ALC_TRUE;
}
@@ -871,7 +871,7 @@ ALCboolean AlsaPlayback::start()
void AlsaPlayback::stop()
{
- if(mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !mThread.joinable())
+ if(mKillNow.exchange(true, std::memory_order_acq_rel) || !mThread.joinable())
return;
mThread.join();
diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp
index 4138c180..6de108cd 100644
--- a/Alc/backends/dsound.cpp
+++ b/Alc/backends/dsound.cpp
@@ -202,7 +202,7 @@ struct DSoundPlayback final : public BackendBase {
IDirectSoundNotify *mNotifies{nullptr};
HANDLE mNotifyEvent{nullptr};
- std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::atomic<bool> mKillNow{true};
std::thread mThread;
static constexpr inline const char *CurrentPrefix() noexcept { return "DSoundPlayback::"; }
@@ -596,7 +596,7 @@ retry_open:
ALCboolean DSoundPlayback::start()
{
try {
- mKillNow.store(AL_FALSE, std::memory_order_release);
+ mKillNow.store(false, std::memory_order_release);
mThread = std::thread{std::mem_fn(&DSoundPlayback::mixerProc), this};
return ALC_TRUE;
}
@@ -610,7 +610,7 @@ ALCboolean DSoundPlayback::start()
void DSoundPlayback::stop()
{
- if(mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !mThread.joinable())
+ if(mKillNow.exchange(true, std::memory_order_acq_rel) || !mThread.joinable())
return;
mThread.join();
diff --git a/Alc/backends/null.cpp b/Alc/backends/null.cpp
index 7f02ad62..cba204f6 100644
--- a/Alc/backends/null.cpp
+++ b/Alc/backends/null.cpp
@@ -55,7 +55,7 @@ struct NullBackend final : public BackendBase {
ALCboolean start() override;
void stop() override;
- std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::atomic<bool> mKillNow{true};
std::thread mThread;
static constexpr inline const char *CurrentPrefix() noexcept { return "NullBackend::"; }
@@ -129,7 +129,7 @@ ALCboolean NullBackend::reset()
ALCboolean NullBackend::start()
{
try {
- mKillNow.store(AL_FALSE, std::memory_order_release);
+ mKillNow.store(false, std::memory_order_release);
mThread = std::thread{std::mem_fn(&NullBackend::mixerProc), this};
return ALC_TRUE;
}
@@ -143,7 +143,7 @@ ALCboolean NullBackend::start()
void NullBackend::stop()
{
- if(mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !mThread.joinable())
+ if(mKillNow.exchange(true, std::memory_order_acq_rel) || !mThread.joinable())
return;
mThread.join();
}
diff --git a/Alc/backends/opensl.cpp b/Alc/backends/opensl.cpp
index 766b7675..69f9cda4 100644
--- a/Alc/backends/opensl.cpp
+++ b/Alc/backends/opensl.cpp
@@ -169,7 +169,7 @@ struct OpenSLPlayback final : public BackendBase {
ALsizei mFrameSize{0};
- std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::atomic<bool> mKillNow{true};
std::thread mThread;
static constexpr inline const char *CurrentPrefix() noexcept { return "OpenSLPlayback::"; }
@@ -550,7 +550,7 @@ ALCboolean OpenSLPlayback::start()
if(SL_RESULT_SUCCESS != result) return ALC_FALSE;
try {
- mKillNow.store(AL_FALSE);
+ mKillNow.store(false, std::memory_order_release);
mThread = std::thread(std::mem_fn(&OpenSLPlayback::mixerProc), this);
return ALC_TRUE;
}
@@ -564,7 +564,7 @@ ALCboolean OpenSLPlayback::start()
void OpenSLPlayback::stop()
{
- if(mKillNow.exchange(AL_TRUE) || !mThread.joinable())
+ if(mKillNow.exchange(true, std::memory_order_acq_rel) || !mThread.joinable())
return;
mSem.post();
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();
diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp
index d221565c..6fe97cb0 100644
--- a/Alc/backends/wasapi.cpp
+++ b/Alc/backends/wasapi.cpp
@@ -525,7 +525,7 @@ struct WasapiPlayback final : public BackendBase, WasapiProxy {
std::atomic<UINT32> mPadding{0u};
- std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::atomic<bool> mKillNow{true};
std::thread mThread;
static constexpr inline const char *CurrentPrefix() noexcept { return "WasapiPlayback::"; }
@@ -1070,7 +1070,7 @@ HRESULT WasapiPlayback::startProxy()
{
mRender = static_cast<IAudioRenderClient*>(ptr);
try {
- mKillNow.store(AL_FALSE, std::memory_order_release);
+ mKillNow.store(false, std::memory_order_release);
mThread = std::thread{std::mem_fn(&WasapiPlayback::mixerProc), this};
}
catch(...) {
@@ -1101,7 +1101,7 @@ void WasapiPlayback::stopProxy()
if(!mRender || !mThread.joinable())
return;
- mKillNow.store(AL_TRUE);
+ mKillNow.store(true, std::memory_order_release);
mThread.join();
mRender->Release();
@@ -1156,7 +1156,7 @@ struct WasapiCapture final : public BackendBase, WasapiProxy {
SampleConverterPtr mSampleConv;
RingBufferPtr mRing;
- std::atomic<int> mKillNow{AL_TRUE};
+ std::atomic<bool> mKillNow{true};
std::thread mThread;
static constexpr inline const char *CurrentPrefix() noexcept { return "WasapiCapture::"; }
@@ -1671,7 +1671,7 @@ HRESULT WasapiCapture::startProxy()
{
mCapture = static_cast<IAudioCaptureClient*>(ptr);
try {
- mKillNow.store(AL_FALSE, std::memory_order_release);
+ mKillNow.store(false, std::memory_order_release);
mThread = std::thread{std::mem_fn(&WasapiCapture::recordProc), this};
}
catch(...) {
@@ -1705,7 +1705,7 @@ void WasapiCapture::stopProxy()
if(!mCapture || !mThread.joinable())
return;
- mKillNow.store(AL_TRUE);
+ mKillNow.store(true, std::memory_order_release);
mThread.join();
mCapture->Release();
diff --git a/Alc/backends/wave.cpp b/Alc/backends/wave.cpp
index 36adce95..42b67a19 100644
--- a/Alc/backends/wave.cpp
+++ b/Alc/backends/wave.cpp
@@ -95,7 +95,7 @@ struct WaveBackend final : public BackendBase {
al::vector<ALbyte> mBuffer;
- std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::atomic<bool> mKillNow{true};
std::thread mThread;
static constexpr inline const char *CurrentPrefix() noexcept { return "WaveBackend::"; }
@@ -328,7 +328,7 @@ ALCboolean WaveBackend::reset()
ALCboolean WaveBackend::start()
{
try {
- mKillNow.store(AL_FALSE, std::memory_order_release);
+ mKillNow.store(false, std::memory_order_release);
mThread = std::thread{std::mem_fn(&WaveBackend::mixerProc), this};
return ALC_TRUE;
}
@@ -342,7 +342,7 @@ ALCboolean WaveBackend::start()
void WaveBackend::stop()
{
- if(mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !mThread.joinable())
+ if(mKillNow.exchange(true, std::memory_order_acq_rel) || !mThread.joinable())
return;
mThread.join();
diff --git a/Alc/backends/winmm.cpp b/Alc/backends/winmm.cpp
index bc599006..34eade29 100644
--- a/Alc/backends/winmm.cpp
+++ b/Alc/backends/winmm.cpp
@@ -144,7 +144,7 @@ struct WinMMPlayback final : public BackendBase {
WAVEFORMATEX mFormat{};
- std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::atomic<bool> mKillNow{true};
std::thread mThread;
static constexpr inline const char *CurrentPrefix() noexcept { return "WinMMPlayback::"; }
@@ -336,7 +336,7 @@ ALCboolean WinMMPlayback::start()
);
mWritable.store(static_cast<ALuint>(mWaveBuffer.size()), std::memory_order_release);
- mKillNow.store(AL_FALSE, std::memory_order_release);
+ mKillNow.store(false, std::memory_order_release);
mThread = std::thread{std::mem_fn(&WinMMPlayback::mixerProc), this};
return ALC_TRUE;
}
@@ -350,7 +350,7 @@ ALCboolean WinMMPlayback::start()
void WinMMPlayback::stop()
{
- if(mKillNow.exchange(AL_TRUE, std::memory_order_acq_rel) || !mThread.joinable())
+ if(mKillNow.exchange(true, std::memory_order_acq_rel) || !mThread.joinable())
return;
mThread.join();
@@ -390,7 +390,7 @@ struct WinMMCapture final : public BackendBase {
WAVEFORMATEX mFormat{};
- std::atomic<ALenum> mKillNow{AL_TRUE};
+ std::atomic<bool> mKillNow{true};
std::thread mThread;
static constexpr inline const char *CurrentPrefix() noexcept { return "WinMMCapture::"; }
@@ -554,7 +554,7 @@ ALCboolean WinMMCapture::start()
waveInAddBuffer(mInHdl, &mWaveBuffer[i], sizeof(WAVEHDR));
}
- mKillNow.store(AL_FALSE, std::memory_order_release);
+ mKillNow.store(false, std::memory_order_release);
mThread = std::thread{std::mem_fn(&WinMMCapture::captureProc), this};
waveInStart(mInHdl);
@@ -572,7 +572,7 @@ void WinMMCapture::stop()
{
waveInStop(mInHdl);
- mKillNow.store(AL_TRUE, std::memory_order_release);
+ mKillNow.store(true, std::memory_order_release);
if(mThread.joinable())
{
mSem.post();