4 #include <SDL_thread.h>
11 void Thread_Shutdown(void)
15 qboolean Thread_HasThreads(void)
20 void *_Thread_CreateMutex(const char *filename, int fileline)
22 void *mutex = SDL_CreateMutex();
24 Sys_PrintfToTerminal("%p mutex create %s:%i\n" , mutex, filename, fileline);
29 void _Thread_DestroyMutex(void *mutex, const char *filename, int fileline)
32 Sys_PrintfToTerminal("%p mutex destroy %s:%i\n", mutex, filename, fileline);
34 SDL_DestroyMutex((SDL_mutex *)mutex);
37 int _Thread_LockMutex(void *mutex, const char *filename, int fileline)
40 Sys_PrintfToTerminal("%p mutex lock %s:%i\n" , mutex, filename, fileline);
42 return SDL_LockMutex((SDL_mutex *)mutex);
45 int _Thread_UnlockMutex(void *mutex, const char *filename, int fileline)
48 Sys_PrintfToTerminal("%p mutex unlock %s:%i\n" , mutex, filename, fileline);
50 return SDL_UnlockMutex((SDL_mutex *)mutex);
53 void *_Thread_CreateCond(const char *filename, int fileline)
55 void *cond = (void *)SDL_CreateCond();
57 Sys_PrintfToTerminal("%p cond create %s:%i\n" , cond, filename, fileline);
62 void _Thread_DestroyCond(void *cond, const char *filename, int fileline)
65 Sys_PrintfToTerminal("%p cond destroy %s:%i\n" , cond, filename, fileline);
67 SDL_DestroyCond((SDL_cond *)cond);
70 int _Thread_CondSignal(void *cond, const char *filename, int fileline)
73 Sys_PrintfToTerminal("%p cond signal %s:%i\n" , cond, filename, fileline);
75 return SDL_CondSignal((SDL_cond *)cond);
78 int _Thread_CondBroadcast(void *cond, const char *filename, int fileline)
81 Sys_PrintfToTerminal("%p cond broadcast %s:%i\n" , cond, filename, fileline);
83 return SDL_CondBroadcast((SDL_cond *)cond);
86 int _Thread_CondWait(void *cond, void *mutex, const char *filename, int fileline)
89 Sys_PrintfToTerminal("%p cond wait %s:%i\n" , cond, filename, fileline);
91 return SDL_CondWait((SDL_cond *)cond, (SDL_mutex *)mutex);
94 void *_Thread_CreateThread(int (*fn)(void *), void *data, const char *filename, int fileline)
96 void *thread = (void *)SDL_CreateThread(fn, data);
98 Sys_PrintfToTerminal("%p thread create %s:%i\n" , thread, filename, fileline);
103 int _Thread_WaitThread(void *thread, int retval, const char *filename, int fileline)
107 Sys_PrintfToTerminal("%p thread wait %s:%i\n" , thread, filename, fileline);
109 SDL_WaitThread((SDL_Thread *)thread, &status);