comparison src/timer/riscos/SDL_systimer.c @ 1361:19418e4422cb

New configure-based build system. Still work in progress, but much improved
author Sam Lantinga <slouken@libsdl.org>
date Thu, 16 Feb 2006 10:11:48 +0000
parents c71e05b4dc2e
children d910939febfa
comparison
equal deleted inserted replaced
1360:70a9cfb4cf1b 1361:19418e4422cb
26 #include <unistd.h> 26 #include <unistd.h>
27 #include <string.h> 27 #include <string.h>
28 #include <errno.h> 28 #include <errno.h>
29 29
30 #include "SDL_timer.h" 30 #include "SDL_timer.h"
31 #include "SDL_timer_c.h" 31 #include "../SDL_timer_c.h"
32 32
33 #ifdef DISABLE_THREADS 33 #if SDL_THREADS_DISABLED
34 /* Timer start/reset time */ 34 /* Timer SDL_arraysize(Timer ),start/reset time */
35 static Uint32 timerStart; 35 static Uint32 timerStart;
36 /* Timer running function */ 36 /* Timer running function */
37 void RISCOS_CheckTimer(); 37 void RISCOS_CheckTimer();
38 #else 38 #else
39 #include <pthread.h> 39 #include <pthread.h>
79 } 79 }
80 80
81 void SDL_Delay (Uint32 ms) 81 void SDL_Delay (Uint32 ms)
82 { 82 {
83 Uint32 now,then,elapsed; 83 Uint32 now,then,elapsed;
84 #ifndef DISABLE_THREADS 84 #if !SDL_THREADS_DISABLED
85 int is_event_thread; 85 int is_event_thread;
86 if (riscos_using_threads) 86 if (riscos_using_threads)
87 { 87 {
88 is_event_thread = 0; 88 is_event_thread = 0;
89 if (SDL_EventThreadID()) 89 if (SDL_EventThreadID())
99 /* Set the timeout interval - Linux only needs to do this once */ 99 /* Set the timeout interval - Linux only needs to do this once */
100 then = SDL_GetTicks(); 100 then = SDL_GetTicks();
101 101
102 do { 102 do {
103 /* Do background tasks required while sleeping as we are not multithreaded */ 103 /* Do background tasks required while sleeping as we are not multithreaded */
104 #ifdef DISABLE_THREADS 104 #if SDL_THREADS_DISABLED
105 RISCOS_BackgroundTasks(); 105 RISCOS_BackgroundTasks();
106 #else 106 #else
107 /* For threaded build only run background tasks in event thread */ 107 /* For threaded build only run background tasks in event thread */
108 if (is_event_thread) RISCOS_BackgroundTasks(); 108 if (is_event_thread) RISCOS_BackgroundTasks();
109 #endif 109 #endif
114 then = now; 114 then = now;
115 if ( elapsed >= ms ) { 115 if ( elapsed >= ms ) {
116 break; 116 break;
117 } 117 }
118 ms -= elapsed; 118 ms -= elapsed;
119 #ifndef DISABLE_THREADS 119 #if !SDL_THREADS_DISABLED
120 /* Need to yield to let other threads have a go */ 120 /* Need to yield to let other threads have a go */
121 if (riscos_using_threads) pthread_yield(); 121 if (riscos_using_threads) pthread_yield();
122 #endif 122 #endif
123 123
124 } while ( 1 ); 124 } while ( 1 );
125 } 125 }
126 126
127 #ifdef DISABLE_THREADS 127 #if SDL_THREADS_DISABLED
128 128
129 /* Non-threaded version of timer */ 129 /* Non-threaded version of timer */
130 130
131 int SDL_SYS_TimerInit(void) 131 int SDL_SYS_TimerInit(void)
132 { 132 {
223 void SDL_SYS_StopTimer(void) 223 void SDL_SYS_StopTimer(void)
224 { 224 {
225 return; 225 return;
226 } 226 }
227 227
228 #endif /* DISABLE_THREADS */ 228 #endif /* SDL_THREADS_DISABLED */