comparison src/timer/SDL_timer.c @ 3578:0d1b16ee0bca

Fixed bug #741 The thread ID is an unsigned long so it can hold pthread_t so people can do naughty things with it. I'm going to be adding additional useful thread API functions, but this should prevent crashes in people's existing code on 64-bit architectures.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 16 Dec 2009 04:48:11 +0000
parents 99210400e8b9
children f7b03b6838cb
comparison
equal deleted inserted replaced
3577:72024425b437 3578:0d1b16ee0bca
126 t->last_alarm += t->interval; 126 t->last_alarm += t->interval;
127 } else { 127 } else {
128 t->last_alarm = now; 128 t->last_alarm = now;
129 } 129 }
130 #ifdef DEBUG_TIMERS 130 #ifdef DEBUG_TIMERS
131 printf("Executing timer %p (thread = %d)\n", t, SDL_ThreadID()); 131 printf("Executing timer %p (thread = %lu)\n", t, SDL_ThreadID());
132 #endif 132 #endif
133 timer = *t; 133 timer = *t;
134 SDL_mutexV(SDL_timer_mutex); 134 SDL_mutexV(SDL_timer_mutex);
135 ms = timer.cb(timer.interval, timer.param); 135 ms = timer.cb(timer.interval, timer.param);
136 SDL_mutexP(SDL_timer_mutex); 136 SDL_mutexP(SDL_timer_mutex);
233 list_changed = SDL_TRUE; 233 list_changed = SDL_TRUE;
234 break; 234 break;
235 } 235 }
236 } 236 }
237 #ifdef DEBUG_TIMERS 237 #ifdef DEBUG_TIMERS
238 printf("SDL_RemoveTimer(%08x) = %d num_timers = %d thread = %d\n", 238 printf("SDL_RemoveTimer(%08x) = %d num_timers = %d thread = %lu\n",
239 (Uint32) id, removed, SDL_timer_running, SDL_ThreadID()); 239 (Uint32) id, removed, SDL_timer_running, SDL_ThreadID());
240 #endif 240 #endif
241 SDL_mutexV(SDL_timer_mutex); 241 SDL_mutexV(SDL_timer_mutex);
242 return removed; 242 return removed;
243 } 243 }