Added SDL_DelayPrecise()
SDL_DelayNS() now passes through to the high precision OS delay function, and SDL_DelayPrecise() tries to busy wait to get as close as possible to the desired wait time. Fixes https://github.com/libsdl-org/SDL/issues/11141
This commit is contained in:
@@ -115,8 +115,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
||||
* Wait a specified number of nanoseconds before returning.
|
||||
*
|
||||
* This function waits a specified number of nanoseconds before returning. It
|
||||
* will attempt to wait as close to the requested time as possible, busy
|
||||
* waiting if necessary, but could return later due to OS scheduling.
|
||||
* waits at least the specified time, but possibly longer due to OS
|
||||
* scheduling.
|
||||
*
|
||||
* \param ns the number of nanoseconds to delay.
|
||||
*
|
||||
@@ -124,6 +124,19 @@ extern SDL_DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_DelayNS(Uint64 ns);
|
||||
|
||||
/**
|
||||
* Wait a specified number of nanoseconds before returning.
|
||||
*
|
||||
* This function waits a specified number of nanoseconds before returning. It
|
||||
* will attempt to wait as close to the requested time as possible, busy
|
||||
* waiting if necessary, but could return later due to OS scheduling.
|
||||
*
|
||||
* \param ns the number of nanoseconds to delay.
|
||||
*
|
||||
* \since This function is available since SDL 3.1.5.
|
||||
*/
|
||||
extern SDL_DECLSPEC void SDLCALL SDL_DelayPrecise(Uint64 ns);
|
||||
|
||||
/**
|
||||
* Definition of the timer ID type.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user