mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-07-21 16:31:22 +00:00
Added thread-safe initialization/cleanup support
Also went through and removed inappropriate uses of spinlocks. Fixes https://github.com/libsdl-org/SDL/issues/10872
This commit is contained in:
@@ -574,16 +574,11 @@ static void SetupAudioResampler(void)
|
||||
|
||||
void SDL_SetupAudioResampler(void)
|
||||
{
|
||||
static SDL_SpinLock running = 0;
|
||||
static SDL_InitState init;
|
||||
|
||||
if (!ResampleFrame[0]) {
|
||||
SDL_LockSpinlock(&running);
|
||||
|
||||
if (!ResampleFrame[0]) {
|
||||
SetupAudioResampler();
|
||||
}
|
||||
|
||||
SDL_UnlockSpinlock(&running);
|
||||
if (SDL_ShouldInit(&init)) {
|
||||
SetupAudioResampler();
|
||||
SDL_SetInitialized(&init, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user