| 236 | } |
| 237 | |
| 238 | void |
| 239 | SDL_TimerQuit(void) |
| 240 | { |
| 241 | SDL_TimerData *data = &SDL_timer_data; |
| 242 | SDL_Timer *timer; |
| 243 | SDL_TimerMap *entry; |
| 244 | |
| 245 | if (SDL_AtomicCAS(&data->active, 1, 0)) { /* active? Move to inactive. */ |
| 246 | /* Shutdown the timer thread */ |
| 247 | if (data->thread) { |
| 248 | SDL_SemPost(data->sem); |
| 249 | SDL_WaitThread(data->thread, NULL); |
| 250 | data->thread = NULL; |
| 251 | } |
| 252 | |
| 253 | SDL_DestroySemaphore(data->sem); |
| 254 | data->sem = NULL; |
| 255 | |
| 256 | /* Clean up the timer entries */ |
| 257 | while (data->timers) { |
| 258 | timer = data->timers; |
| 259 | data->timers = timer->next; |
| 260 | SDL_free(timer); |
| 261 | } |
| 262 | while (data->freelist) { |
| 263 | timer = data->freelist; |
| 264 | data->freelist = timer->next; |
| 265 | SDL_free(timer); |
| 266 | } |
| 267 | while (data->timermap) { |
| 268 | entry = data->timermap; |
| 269 | data->timermap = entry->next; |
| 270 | SDL_free(entry); |
| 271 | } |
| 272 | |
| 273 | SDL_DestroyMutex(data->timermap_lock); |
| 274 | data->timermap_lock = NULL; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | SDL_TimerID |
| 279 | SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param) |
no test coverage detected