Avoid using ATOMIC_LOAD on ALCdevice::Connected

This commit is contained in:
Chris Robinson
2018-11-26 18:07:52 -08:00
parent 1a9edd4e35
commit 461ef4196e
11 changed files with 17 additions and 18 deletions
+2 -2
View File
@@ -1150,7 +1150,7 @@ ALCenum ALCcaptureAlsa_captureSamples(ALCcaptureAlsa *self, ALCvoid *buffer, ALC
}
self->mLastAvail -= samples;
while(ATOMIC_LOAD(&device->Connected, almemory_order_acquire) && samples > 0)
while(device->Connected.load(std::memory_order_acquire) && samples > 0)
{
snd_pcm_sframes_t amt{0};
@@ -1208,7 +1208,7 @@ ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self)
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
snd_pcm_sframes_t avail{0};
if(ATOMIC_LOAD(&device->Connected, almemory_order_acquire) && self->DoCapture)
if(device->Connected.load(std::memory_order_acquire) && self->DoCapture)
avail = snd_pcm_avail_update(self->PcmHandle);
if(avail < 0)
{
+2 -2
View File
@@ -272,7 +272,7 @@ FORCE_ALIGN int ALCdsoundPlayback_mixerProc(ALCdsoundPlayback *self)
DWORD LastCursor{0u};
Buffer->GetCurrentPosition(&LastCursor, nullptr);
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
// Get current play cursor
DWORD PlayCursor;
@@ -901,7 +901,7 @@ ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self)
{
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
if(!ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
if(!device->Connected.load(std::memory_order_acquire))
return ll_ringbuffer_read_space(self->Ring);
ALsizei FrameSize{FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder)};
+1 -1
View File
@@ -301,7 +301,7 @@ static int ALCjackPlayback_mixerProc(void *arg)
ALCjackPlayback_lock(self);
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
ALuint todo, len1, len2;
+1 -1
View File
@@ -92,7 +92,7 @@ int ALCnullBackend_mixerProc(ALCnullBackend *self)
ALint64 done{0};
auto start = std::chrono::steady_clock::now();
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
auto now = std::chrono::steady_clock::now();
+2 -3
View File
@@ -248,9 +248,8 @@ static int ALCopenslPlayback_mixerProc(void *arg)
if(SL_RESULT_SUCCESS != result)
aluHandleDisconnect(device, "Failed to get playback buffer: 0x%08x", result);
while(SL_RESULT_SUCCESS == result &&
!ATOMIC_LOAD(&self->mKillNow, almemory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
while(SL_RESULT_SUCCESS == result && !self->mKillNow.load(std::memory_order_acquire) &&
device->Connected.load(std::memory_order_acquire))
{
size_t todo;
+1 -1
View File
@@ -302,7 +302,7 @@ int ALCplaybackOSS_mixerProc(ALCplaybackOSS *self)
ALCplaybackOSS_lock(self);
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
FD_ZERO(&wfds);
FD_SET(self->fd, &wfds);
+2 -2
View File
@@ -871,7 +871,7 @@ int PulsePlayback_mixerProc(PulsePlayback *self)
size_t frame_size{pa_frame_size(&self->spec)};
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
ssize_t len{static_cast<ssize_t>(pa_stream_writable_size(self->stream))};
if(UNLIKELY(len < 0))
@@ -1676,7 +1676,7 @@ ALCuint PulseCapture_availableSamples(PulseCapture *self)
ALCdevice *device{STATIC_CAST(ALCbackend,self)->mDevice};
size_t readable{self->cap_remain};
if(ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
if(device->Connected.load(std::memory_order_acquire))
{
palock_guard _{self->loop};
size_t got{pa_stream_readable_size(self->stream)};
+2 -2
View File
@@ -99,7 +99,7 @@ static int SndioPlayback_mixerProc(void *ptr)
frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
ALsizei len = self->data_size;
ALubyte *WritePtr = static_cast<ALubyte*>(self->mix_data);
@@ -335,7 +335,7 @@ static int SndioCapture_recordProc(void* ptr)
frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->mAmbiOrder);
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
size_t total, todo;
+1 -1
View File
@@ -117,7 +117,7 @@ static int ALCsolarisBackend_mixerProc(void *ptr)
ALCsolarisBackend_lock(self);
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
FD_ZERO(&wfds);
FD_SET(self->fd, &wfds);
+1 -1
View File
@@ -135,7 +135,7 @@ int ALCwaveBackend_mixerProc(ALCwaveBackend *self)
ALint64 done{0};
auto start = std::chrono::steady_clock::now();
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
auto now = std::chrono::steady_clock::now();
+2 -2
View File
@@ -206,7 +206,7 @@ FORCE_ALIGN int ALCwinmmPlayback_mixerProc(ALCwinmmPlayback *self)
ALCwinmmPlayback_lock(self);
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
ALsizei todo = self->Writable.load(std::memory_order_acquire);
if(todo < 1)
@@ -487,7 +487,7 @@ int ALCwinmmCapture_captureProc(ALCwinmmCapture *self)
ALCwinmmCapture_lock(self);
while(!self->mKillNow.load(std::memory_order_acquire) &&
ATOMIC_LOAD(&device->Connected, almemory_order_acquire))
device->Connected.load(std::memory_order_acquire))
{
ALsizei todo = self->Readable.load(std::memory_order_acquire);
if(todo < 1)