Mercurial > sdl-ios-xcode
comparison src/timer/dummy/SDL_systimer.c @ 1895:c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 10 Jul 2006 21:04:37 +0000 |
parents | 92947e3a18db |
children | 99210400e8b9 |
comparison
equal
deleted
inserted
replaced
1894:c69cee13dd76 | 1895:c121d94672cb |
---|---|
24 #if defined(SDL_TIMER_DUMMY) || defined(SDL_TIMERS_DISABLED) | 24 #if defined(SDL_TIMER_DUMMY) || defined(SDL_TIMERS_DISABLED) |
25 | 25 |
26 #include "SDL_timer.h" | 26 #include "SDL_timer.h" |
27 #include "../SDL_timer_c.h" | 27 #include "../SDL_timer_c.h" |
28 | 28 |
29 void SDL_StartTicks(void) | 29 void |
30 SDL_StartTicks(void) | |
30 { | 31 { |
31 } | 32 } |
32 | 33 |
33 Uint32 SDL_GetTicks (void) | 34 Uint32 |
35 SDL_GetTicks(void) | |
34 { | 36 { |
35 SDL_Unsupported(); | 37 SDL_Unsupported(); |
36 return 0; | 38 return 0; |
37 } | 39 } |
38 | 40 |
39 void SDL_Delay (Uint32 ms) | 41 void |
42 SDL_Delay(Uint32 ms) | |
40 { | 43 { |
41 SDL_Unsupported(); | 44 SDL_Unsupported(); |
42 } | 45 } |
43 | 46 |
44 #include "SDL_thread.h" | 47 #include "SDL_thread.h" |
45 | 48 |
46 /* Data to handle a single periodic alarm */ | 49 /* Data to handle a single periodic alarm */ |
47 static int timer_alive = 0; | 50 static int timer_alive = 0; |
48 static SDL_Thread *timer = NULL; | 51 static SDL_Thread *timer = NULL; |
49 | 52 |
50 static int RunTimer(void *unused) | 53 static int |
54 RunTimer(void *unused) | |
51 { | 55 { |
52 while ( timer_alive ) { | 56 while (timer_alive) { |
53 if ( SDL_timer_running ) { | 57 if (SDL_timer_running) { |
54 SDL_ThreadedTimerCheck(); | 58 SDL_ThreadedTimerCheck(); |
55 } | 59 } |
56 SDL_Delay(1); | 60 SDL_Delay(1); |
57 } | 61 } |
58 return(0); | 62 return (0); |
59 } | 63 } |
60 | 64 |
61 /* This is only called if the event thread is not running */ | 65 /* This is only called if the event thread is not running */ |
62 int SDL_SYS_TimerInit(void) | 66 int |
67 SDL_SYS_TimerInit(void) | |
63 { | 68 { |
64 timer_alive = 1; | 69 timer_alive = 1; |
65 timer = SDL_CreateThread(RunTimer, NULL); | 70 timer = SDL_CreateThread(RunTimer, NULL); |
66 if ( timer == NULL ) | 71 if (timer == NULL) |
67 return(-1); | 72 return (-1); |
68 return(SDL_SetTimerThreaded(1)); | 73 return (SDL_SetTimerThreaded(1)); |
69 } | 74 } |
70 | 75 |
71 void SDL_SYS_TimerQuit(void) | 76 void |
77 SDL_SYS_TimerQuit(void) | |
72 { | 78 { |
73 timer_alive = 0; | 79 timer_alive = 0; |
74 if ( timer ) { | 80 if (timer) { |
75 SDL_WaitThread(timer, NULL); | 81 SDL_WaitThread(timer, NULL); |
76 timer = NULL; | 82 timer = NULL; |
77 } | 83 } |
78 } | 84 } |
79 | 85 |
80 int SDL_SYS_StartTimer(void) | 86 int |
87 SDL_SYS_StartTimer(void) | |
81 { | 88 { |
82 SDL_SetError("Internal logic error: threaded timer in use"); | 89 SDL_SetError("Internal logic error: threaded timer in use"); |
83 return(-1); | 90 return (-1); |
84 } | 91 } |
85 | 92 |
86 void SDL_SYS_StopTimer(void) | 93 void |
94 SDL_SYS_StopTimer(void) | |
87 { | 95 { |
88 return; | 96 return; |
89 } | 97 } |
90 | 98 |
91 #endif /* SDL_TIMER_DUMMY || SDL_TIMERS_DISABLED */ | 99 #endif /* SDL_TIMER_DUMMY || SDL_TIMERS_DISABLED */ |
100 /* vi: set ts=4 sw=4 expandtab: */ |