21 #include "../SDL_internal.h" 27 #include "../thread/SDL_systhread.h" 31 typedef struct _SDL_Timer
42 typedef struct _SDL_TimerMap
46 struct _SDL_TimerMap *
next;
85 for (curr = data->
timers; curr; prev = curr, curr = curr->
next) {
108 Uint32 tick, now, interval, delay;
134 pending = pending->
next;
137 freelist_head =
NULL;
138 freelist_tail =
NULL;
175 if (!freelist_head) {
176 freelist_head = current;
179 freelist_tail->
next = current;
181 freelist_tail = current;
189 interval = (now - tick);
190 if (interval > delay) {
212 const char *
name =
"SDLTimer";
321 entry->
timer = timer;
351 for (entry = data->
timermap; entry; prev = entry, entry = entry->
next) {
static int SDL_TimerThread(void *_data)
Uint32(* SDL_TimerCallback)(Uint32 interval, void *param)
A type representing an atomic integer value. It is a struct so people don't accidentally use numeric ...
#define SDL_CreateSemaphore
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param)
Add a new timer to the pool of timers already running.
GLuint const GLchar * name
SDL_bool SDL_RemoveTimer(SDL_TimerID id)
Remove a timer knowing its ID.
SDL_Thread * SDL_CreateThreadInternal(int(*fn)(void *), const char *name, const size_t stacksize, void *data)
#define SDL_SemWaitTimeout
#define SDL_MUTEX_MAXWAIT
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
SDL_TimerCallback callback
#define SDL_CACHELINE_SIZE
static Uint32 callback(Uint32 interval, void *param)
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
struct _SDL_TimerMap * next
#define SDL_OutOfMemory()
static void SDL_AddTimerInternal(SDL_TimerData *data, SDL_Timer *timer)
SDL_mutex * timermap_lock
#define SDL_DestroySemaphore
static SDL_TimerData SDL_timer_data