]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - thread_sdl.c
5272221e946206fe6955725a2a447dae51d9f274
[xonotic/darkplaces.git] / thread_sdl.c
1 #include "quakedef.h"
2 #include "thread.h"
3 #include <SDL.h>
4 #include <SDL_thread.h>
5
6 int Thread_Init(void)
7 {
8         return 0;
9 }
10
11 void Thread_Shutdown(void)
12 {
13 }
14
15 qboolean Thread_HasThreads(void)
16 {
17         return true;
18 }
19
20 void *Thread_CreateMutex(void)
21 {
22         return SDL_CreateMutex();
23 }
24
25 void Thread_DestroyMutex(void *mutex)
26 {
27         SDL_DestroyMutex((SDL_mutex *)mutex);
28 }
29
30 int Thread_LockMutex(void *mutex)
31 {
32         return SDL_LockMutex((SDL_mutex *)mutex);
33 }
34
35 int Thread_UnlockMutex(void *mutex)
36 {
37         return SDL_UnlockMutex((SDL_mutex *)mutex);
38 }
39
40 void *Thread_CreateCond(void)
41 {
42         return SDL_CreateCond();
43 }
44
45 void Thread_DestroyCond(void *cond)
46 {
47         SDL_DestroyCond((SDL_cond *)cond);
48 }
49
50 int Thread_CondSignal(void *cond)
51 {
52         return SDL_CondSignal((SDL_cond *)cond);
53 }
54
55 int Thread_CondBroadcast(void *cond)
56 {
57         return SDL_CondBroadcast((SDL_cond *)cond);
58 }
59
60 int Thread_CondWait(void *cond, void *mutex)
61 {
62         return SDL_CondWait((SDL_cond *)cond, (SDL_mutex *)mutex);
63 }
64
65 void *Thread_CreateThread(int (*fn)(void *), void *data)
66 {
67         return SDL_CreateThread(fn, data);
68 }
69
70 int Thread_WaitThread(void *thread, int retval)
71 {
72         int status = retval;
73         SDL_WaitThread((SDL_Thread *)thread, &status);
74         return status;
75 }
76
77