Updated the atomic API for SDL 3.0 naming conventions

Fixes https://github.com/libsdl-org/SDL/issues/7388
This commit is contained in:
Sam Lantinga
2024-01-18 03:39:55 -08:00
parent 4e60fc9b2b
commit a2665f54c8
24 changed files with 156 additions and 112 deletions

View File

@@ -635,7 +635,7 @@ void SDL_AudioDeviceDisconnected(SDL_AudioDevice *device)
const SDL_bool is_default_device = ((devid == current_audio.default_output_device_id) || (devid == current_audio.default_capture_device_id));
SDL_UnlockRWLock(current_audio.device_hash_lock);
const SDL_bool first_disconnect = SDL_AtomicCAS(&device->zombie, 0, 1);
const SDL_bool first_disconnect = SDL_AtomicCompareAndSwap(&device->zombie, 0, 1);
if (first_disconnect) { // if already disconnected this device, don't do it twice.
// Swap in "Zombie" versions of the usual platform interfaces, so the device will keep
// making progress until the app closes it. Otherwise, streams might continue to
@@ -809,7 +809,7 @@ int SDL_InitAudio(const char *driver_name)
}
// make sure device IDs start at 2 (because of SDL2 legacy interface), but don't reset the counter on each init, in case the app is holding an old device ID somewhere.
SDL_AtomicCAS(&last_device_instance_id, 0, 2);
SDL_AtomicCompareAndSwap(&last_device_instance_id, 0, 2);
SDL_ChooseAudioConverters();
SDL_SetupAudioResampler();