| | |
| | | #include <errno.h> |
| | | |
| | | #include "SDL_timer.h" |
| | | #include "SDL_assert.h" |
| | | #include "SDL_hints.h" |
| | | #include "../SDL_timer_c.h" |
| | | |
| | | #ifdef __EMSCRIPTEN__ |
| | | #include <emscripten.h> |
| | | #endif |
| | | |
| | | /* The clock_gettime provides monotonous time, so we should use it if |
| | | it's available. The clock_gettime function is behind ifdef |
| | |
| | | void |
| | | SDL_Delay(Uint32 ms) |
| | | { |
| | | #ifdef __EMSCRIPTEN__ |
| | | if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { |
| | | /* pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent */ |
| | | emscripten_sleep(ms); |
| | | return; |
| | | } |
| | | #endif |
| | | int was_error; |
| | | |
| | | #if HAVE_NANOSLEEP |