aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alc.cpp4
-rw-r--r--Alc/backends/base.cpp4
-rw-r--r--Alc/backends/opensl.cpp2
-rw-r--r--OpenAL32/alAuxEffectSlot.cpp5
-rw-r--r--OpenAL32/alSource.cpp9
-rw-r--r--OpenAL32/event.cpp2
-rw-r--r--common/threads.h13
7 files changed, 15 insertions, 24 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index 58b2349f..ba693616 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -1624,7 +1624,7 @@ void ALCcontext_ProcessUpdates(ALCcontext *context)
*/
context->HoldUpdates.store(AL_TRUE);
while((context->UpdateCount.load(std::memory_order_acquire)&1) != 0)
- althrd_yield();
+ std::this_thread::yield();
if(!context->PropsClean.test_and_set(std::memory_order_acq_rel))
UpdateContextProps(context);
@@ -3434,7 +3434,7 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname,
ALuint refcount;
do {
while(((refcount=ReadRef(&dev->MixCount))&1) != 0)
- althrd_yield();
+ std::this_thread::yield();
basecount = dev->ClockBase;
samplecount = dev->SamplesDone;
} while(refcount != ReadRef(&dev->MixCount));
diff --git a/Alc/backends/base.cpp b/Alc/backends/base.cpp
index e4c7588c..85f4b034 100644
--- a/Alc/backends/base.cpp
+++ b/Alc/backends/base.cpp
@@ -3,6 +3,8 @@
#include <stdlib.h>
+#include <thread>
+
#include "alMain.h"
#include "alu.h"
@@ -56,7 +58,7 @@ ClockLatency ALCbackend_getClockLatency(ALCbackend *self)
do {
while(((refcount=device->MixCount.load(std::memory_order_acquire))&1))
- althrd_yield();
+ std::this_thread::yield();
ret.ClockTime = GetDeviceClockTime(device);
std::atomic_thread_fence(std::memory_order_acquire);
} while(refcount != device->MixCount.load(std::memory_order_relaxed));
diff --git a/Alc/backends/opensl.cpp b/Alc/backends/opensl.cpp
index 8cea36f3..e8d4a862 100644
--- a/Alc/backends/opensl.cpp
+++ b/Alc/backends/opensl.cpp
@@ -632,7 +632,7 @@ static void ALCopenslPlayback_stop(ALCopenslPlayback *self)
{
SLAndroidSimpleBufferQueueState state;
do {
- althrd_yield();
+ std::this_thread::yield();
result = VCALL(bufferQueue,GetState)(&state);
} while(SL_RESULT_SUCCESS == result && state.count > 0);
PRINTERR(result, "bufferQueue->GetState");
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();
diff --git a/common/threads.h b/common/threads.h
index 064b8482..a357b494 100644
--- a/common/threads.h
+++ b/common/threads.h
@@ -34,12 +34,6 @@ enum {
typedef HANDLE alsem_t;
-
-inline void althrd_yield(void)
-{
- SwitchToThread();
-}
-
#else
#include <stdint.h>
@@ -57,13 +51,6 @@ typedef dispatch_semaphore_t alsem_t;
typedef sem_t alsem_t;
#endif /* __APPLE__ */
-
-inline void althrd_yield(void)
-{
- sched_yield();
-}
-
-
#endif
void althrd_setname(const char *name);