4 #include <SDL_thread.h>
9 Con_Printf("Threading disabled in this build\n");
14 void Thread_Shutdown(void)
18 qboolean Thread_HasThreads(void)
27 void *_Thread_CreateMutex(const char *filename, int fileline)
29 void *mutex = SDL_CreateMutex();
31 Sys_PrintfToTerminal("%p mutex create %s:%i\n" , mutex, filename, fileline);
36 void _Thread_DestroyMutex(void *mutex, const char *filename, int fileline)
39 Sys_PrintfToTerminal("%p mutex destroy %s:%i\n", mutex, filename, fileline);
41 SDL_DestroyMutex((SDL_mutex *)mutex);
44 int _Thread_LockMutex(void *mutex, const char *filename, int fileline)
47 Sys_PrintfToTerminal("%p mutex lock %s:%i\n" , mutex, filename, fileline);
49 return SDL_LockMutex((SDL_mutex *)mutex);
52 int _Thread_UnlockMutex(void *mutex, const char *filename, int fileline)
55 Sys_PrintfToTerminal("%p mutex unlock %s:%i\n" , mutex, filename, fileline);
57 return SDL_UnlockMutex((SDL_mutex *)mutex);
60 void *_Thread_CreateCond(const char *filename, int fileline)
62 void *cond = (void *)SDL_CreateCond();
64 Sys_PrintfToTerminal("%p cond create %s:%i\n" , cond, filename, fileline);
69 void _Thread_DestroyCond(void *cond, const char *filename, int fileline)
72 Sys_PrintfToTerminal("%p cond destroy %s:%i\n" , cond, filename, fileline);
74 SDL_DestroyCond((SDL_cond *)cond);
77 int _Thread_CondSignal(void *cond, const char *filename, int fileline)
80 Sys_PrintfToTerminal("%p cond signal %s:%i\n" , cond, filename, fileline);
82 return SDL_CondSignal((SDL_cond *)cond);
85 int _Thread_CondBroadcast(void *cond, const char *filename, int fileline)
88 Sys_PrintfToTerminal("%p cond broadcast %s:%i\n" , cond, filename, fileline);
90 return SDL_CondBroadcast((SDL_cond *)cond);
93 int _Thread_CondWait(void *cond, void *mutex, const char *filename, int fileline)
96 Sys_PrintfToTerminal("%p cond wait %s:%i\n" , cond, filename, fileline);
98 return SDL_CondWait((SDL_cond *)cond, (SDL_mutex *)mutex);
101 void *_Thread_CreateThread(int (*fn)(void *), void *data, const char *filename, int fileline)
103 void *thread = (void *)SDL_CreateThread(fn, data);
105 Sys_PrintfToTerminal("%p thread create %s:%i\n" , thread, filename, fileline);
110 int _Thread_WaitThread(void *thread, int retval, const char *filename, int fileline)
114 Sys_PrintfToTerminal("%p thread wait %s:%i\n" , thread, filename, fileline);
116 SDL_WaitThread((SDL_Thread *)thread, &status);