Skip to content

Commit

Permalink
SDL3: Remove usage of SDL_DelayNS in sleep calls.
Browse files Browse the repository at this point in the history
SDL3 currently busy-waits in its implementation, which defeats the purpose of the sleep calls.
  • Loading branch information
slime73 committed Oct 10, 2024
1 parent 8227b7b commit f20b413
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/common/delay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,12 @@
namespace love
{

// TODO: use ns.
// TODO: use ns. https://github.com/libsdl-org/SDL/issues/11141
void sleep(double ms)
{
// We don't need to initialize the SDL timer subsystem for SDL_Delay to
// function - and doing so causes SDL to create a worker thread.
#if SDL_VERSION_ATLEAST(3, 0, 0)
SDL_DelayNS(SDL_MS_TO_NS(ms));
#else
SDL_Delay((Uint32)ms);
#endif
}

} // love

0 comments on commit f20b413

Please sign in to comment.