Mercurial > sdl-ios-xcode
diff include/SDL_compat.h @ 5113:481dabb098ef
Improved timer implementation
The new timer model is formalized as using a separate thread to handle timer callbacks. This was the case on almost every platform before, but it's now a requirement, and simplifies the implementation and makes it perform consistently across platforms.
Goals:
* Minimize timer thread blocking
* Dispatch timers as accurately as possible
* SDL_AddTimer() and SDL_RemoveTimer() are completely threadsafe
* SDL_RemoveTimer() doesn't crash with a timer that's expired or removed
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 27 Jan 2011 14:45:06 -0800 |
parents | c2539ff054c8 |
children | da10636e5eca |
line wrap: on
line diff
--- a/include/SDL_compat.h Thu Jan 27 10:40:17 2011 -0800 +++ b/include/SDL_compat.h Thu Jan 27 14:45:06 2011 -0800 @@ -344,6 +344,13 @@ #define SDL_RenderFill(X) (X) ? SDL_RenderFillRect(X) : SDL_RenderClear() #define SDL_KillThread(X) +/* The timeslice and timer resolution are no longer relevant */ +#define SDL_TIMESLICE 10 +#define TIMER_RESOLUTION 10 + +typedef Uint32 (SDLCALL * SDL_OldTimerCallback) (Uint32 interval); +extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_OldTimerCallback callback); + extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); /*@}*//*Compatibility*/