comparison src/timer/dummy/SDL_systimer.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
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 29 void
30 SDL_StartTicks (void) 30 SDL_StartTicks(void)
31 { 31 {
32 } 32 }
33 33
34 Uint32 34 Uint32
35 SDL_GetTicks (void) 35 SDL_GetTicks(void)
36 { 36 {
37 SDL_Unsupported (); 37 SDL_Unsupported();
38 return 0; 38 return 0;
39 } 39 }
40 40
41 void 41 void
42 SDL_Delay (Uint32 ms) 42 SDL_Delay(Uint32 ms)
43 { 43 {
44 SDL_Unsupported (); 44 SDL_Unsupported();
45 } 45 }
46 46
47 #include "SDL_thread.h" 47 #include "SDL_thread.h"
48 48
49 /* Data to handle a single periodic alarm */ 49 /* Data to handle a single periodic alarm */
50 static int timer_alive = 0; 50 static int timer_alive = 0;
51 static SDL_Thread *timer = NULL; 51 static SDL_Thread *timer = NULL;
52 52
53 static int 53 static int
54 RunTimer (void *unused) 54 RunTimer(void *unused)
55 { 55 {
56 while (timer_alive) { 56 while (timer_alive) {
57 if (SDL_timer_running) { 57 if (SDL_timer_running) {
58 SDL_ThreadedTimerCheck (); 58 SDL_ThreadedTimerCheck();
59 } 59 }
60 SDL_Delay (1); 60 SDL_Delay(1);
61 } 61 }
62 return (0); 62 return (0);
63 } 63 }
64 64
65 /* This is only called if the event thread is not running */ 65 /* This is only called if the event thread is not running */
66 int 66 int
67 SDL_SYS_TimerInit (void) 67 SDL_SYS_TimerInit(void)
68 { 68 {
69 timer_alive = 1; 69 timer_alive = 1;
70 timer = SDL_CreateThread (RunTimer, NULL); 70 timer = SDL_CreateThread(RunTimer, NULL);
71 if (timer == NULL) 71 if (timer == NULL)
72 return (-1); 72 return (-1);
73 return (SDL_SetTimerThreaded (1)); 73 return (SDL_SetTimerThreaded(1));
74 } 74 }
75 75
76 void 76 void
77 SDL_SYS_TimerQuit (void) 77 SDL_SYS_TimerQuit(void)
78 { 78 {
79 timer_alive = 0; 79 timer_alive = 0;
80 if (timer) { 80 if (timer) {
81 SDL_WaitThread (timer, NULL); 81 SDL_WaitThread(timer, NULL);
82 timer = NULL; 82 timer = NULL;
83 } 83 }
84 } 84 }
85 85
86 int 86 int
87 SDL_SYS_StartTimer (void) 87 SDL_SYS_StartTimer(void)
88 { 88 {
89 SDL_SetError ("Internal logic error: threaded timer in use"); 89 SDL_SetError("Internal logic error: threaded timer in use");
90 return (-1); 90 return (-1);
91 } 91 }
92 92
93 void 93 void
94 SDL_SYS_StopTimer (void) 94 SDL_SYS_StopTimer(void)
95 { 95 {
96 return; 96 return;
97 } 97 }
98 98
99 #endif /* SDL_TIMER_DUMMY || SDL_TIMERS_DISABLED */ 99 #endif /* SDL_TIMER_DUMMY || SDL_TIMERS_DISABLED */