mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-13 07:03:54 +00:00
61363588407195518c5fe0f3c99a3175f0fb85ed
Otherwise, a device that is disconnected in the standard audio device thread might keep failing WaitDevice() in a tight loop, each one generating a new main thread callback. In normal situations, this is wasteful, but if the app isn't pumping the event loop quickly (or at all!), this will quickly eat up all the memory in a machine. Now we note that the device is zombified right away, and device thread iteration will use this to replace the implementation with the Zombie equivalents once it owns the device lock. The main thread callback will progress to device->zombie==2, which it uses to decide if this is a duplicate disconnect notification. Since it also owns the lock at this point, it takes the moment to set the Zombie implementation up, too. This allows things (like the WASAPI backend) to check for a non-zero zombie state immediately without having to worry if the main thread callback ran, and for the standard audio threads to also move to the Zombie implementation without waiting on that callback. (The Zombie implementation is used to make a dead device keep processing, so things that need the audio device to make progress to function will keep working, and things blindly pushing to an audio stream won't queue up endless data that isn't being consumed.) Fixes #15745.
Simple DirectMedia Layer (SDL for short) is a cross-platform library designed to make it easy to write multi-media software, such as games and emulators.
You can find the latest release and additional information at: https://www.libsdl.org/
Installation instructions and a quick introduction is available in INSTALL.md
This library is distributed under the terms of the zlib license, available in LICENSE.txt.
Enjoy!
Sam Lantinga (slouken@libsdl.org)
Languages
C
87.9%
C++
4%
Objective-C
3.4%
CMake
1.8%
Java
0.7%
Other
1.9%