aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-26 23:06:49 -0800
committerChris Robinson <[email protected]>2018-11-26 23:06:49 -0800
commitd06f76957c6ea2bf5311322e103946b45bde9796 (patch)
tree81ccb8de0a66a74568821bca8f09b9705851ac08 /OpenAL32
parent4c1fc3ae00ad4890708a8789539eea4556b0634c (diff)
Remove althrd_yield
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alAuxEffectSlot.cpp5
-rw-r--r--OpenAL32/alSource.cpp9
-rw-r--r--OpenAL32/event.cpp2
3 files changed, 9 insertions, 7 deletions
diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp
index 663d99ba..7f05187e 100644
--- a/OpenAL32/alAuxEffectSlot.cpp
+++ b/OpenAL32/alAuxEffectSlot.cpp
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <math.h>
+#include <thread>
#include <algorithm>
#include "AL/al.h"
@@ -108,7 +109,7 @@ void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *cont
curarray = context->ActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel);
ALCdevice *device{context->Device};
while((device->MixCount.load(std::memory_order_acquire)&1))
- althrd_yield();
+ std::this_thread::yield();
al_free(curarray);
}
@@ -136,7 +137,7 @@ void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *c
curarray = context->ActiveAuxSlots.exchange(newarray, std::memory_order_acq_rel);
ALCdevice *device{context->Device};
while((device->MixCount.load(std::memory_order_acquire)&1))
- althrd_yield();
+ std::this_thread::yield();
al_free(curarray);
}
diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp
index 7cba253a..d113ad40 100644
--- a/OpenAL32/alSource.cpp
+++ b/OpenAL32/alSource.cpp
@@ -25,6 +25,7 @@
#include <float.h>
#include <cmath>
+#include <thread>
#include <limits>
#include <algorithm>
@@ -159,7 +160,7 @@ ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, std::chrono
Current = nullptr;
readPos = 0;
while(((refcount=device->MixCount.load(std::memory_order_acquire))&1))
- althrd_yield();
+ std::this_thread::yield();
*clocktime = GetDeviceClockTime(device);
voice = GetSourceVoice(Source, context);
@@ -205,7 +206,7 @@ ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, std::chrono::
Current = nullptr;
readPos = 0;
while(((refcount=device->MixCount.load(std::memory_order_acquire))&1))
- althrd_yield();
+ std::this_thread::yield();
*clocktime = GetDeviceClockTime(device);
voice = GetSourceVoice(Source, context);
@@ -266,7 +267,7 @@ ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context)
Current = nullptr;
readPos = readPosFrac = 0;
while(((refcount=device->MixCount.load(std::memory_order_acquire))&1))
- althrd_yield();
+ std::this_thread::yield();
voice = GetSourceVoice(Source, context);
if(voice)
{
@@ -1248,7 +1249,7 @@ ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, co
* end.
*/
while((device->MixCount.load(std::memory_order_acquire)&1))
- althrd_yield();
+ std::this_thread::yield();
}
}
return AL_TRUE;
diff --git a/OpenAL32/event.cpp b/OpenAL32/event.cpp
index 233794bd..a47787bd 100644
--- a/OpenAL32/event.cpp
+++ b/OpenAL32/event.cpp
@@ -65,7 +65,7 @@ void StopEventThrd(ALCcontext *ctx)
{
static constexpr AsyncEvent kill_evt = ASYNC_EVENT(EventType_KillThread);
while(ll_ringbuffer_write(ctx->AsyncEvents, &kill_evt, 1) == 0)
- althrd_yield();
+ std::this_thread::yield();
alsem_post(&ctx->EventSem);
if(ctx->EventThread.joinable())
ctx->EventThread.join();