All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_timer.c File Reference
#include "SDL_config.h"
#include "SDL_timer.h"
#include "SDL_timer_c.h"
#include "SDL_atomic.h"
#include "SDL_cpuinfo.h"
#include "SDL_thread.h"

Go to the source code of this file.


typedef struct _SDL_Timer SDL_Timer
typedef struct _SDL_TimerMap SDL_TimerMap


SDL_TimerID SDL_AddTimer (Uint32 interval, SDL_TimerCallback callback, void *param)
 Add a new timer to the pool of timers already running. More...
static void SDL_AddTimerInternal (SDL_TimerData *data, SDL_Timer *timer)
SDL_bool SDL_RemoveTimer (SDL_TimerID id)
 Remove a timer knowing its ID. More...
int SDL_TimerInit (void)
void SDL_TimerQuit (void)
static int SDL_TimerThread (void *_data)


static SDL_TimerData SDL_timer_data

Typedef Documentation

typedef struct _SDL_Timer SDL_Timer
typedef struct _SDL_TimerMap SDL_TimerMap

Function Documentation

SDL_TimerID SDL_AddTimer ( Uint32  interval,
SDL_TimerCallback  callback,
void param 

Add a new timer to the pool of timers already running.

A timer ID, or NULL when an error occurs.

Definition at line 284 of file SDL_timer.c.

References SDL_AtomicIncRef, SDL_AtomicLock(), SDL_AtomicUnlock(), SDL_FALSE, SDL_free(), SDL_GetTicks(), SDL_LockMutex(), SDL_malloc(), SDL_OutOfMemory, SDL_RemoveTimer(), SDL_SemPost(), SDL_timer_data, SDL_TimerInit(), and SDL_UnlockMutex().

Referenced by SDLTest_SetTestTimeout().

static void SDL_AddTimerInternal ( SDL_TimerData *  data,
SDL_Timer timer 

Definition at line 80 of file SDL_timer.c.

References NULL.

Referenced by SDL_TimerThread().

SDL_bool SDL_RemoveTimer ( SDL_TimerID  id)

Remove a timer knowing its ID.

A boolean value indicating success or failure.
It is not safe to remove a timer multiple times.

Definition at line 354 of file SDL_timer.c.

References NULL, SDL_FALSE, SDL_free(), SDL_LockMutex(), SDL_timer_data, SDL_TRUE, and SDL_UnlockMutex().

Referenced by SDL_AddTimer(), and SDLTest_RunTest().

static int SDL_TimerThread ( void _data)

Variable Documentation

SDL_TimerData SDL_timer_data

Definition at line 71 of file SDL_timer.c.

Referenced by SDL_AddTimer(), SDL_RemoveTimer(), SDL_TimerInit(), and SDL_TimerQuit().