src/util/threading.h (view raw)
1/* Copyright (c) 2013-2015 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef THREADING_H
7#define THREADING_H
8
9#include "util/common.h"
10
11#ifndef DISABLE_THREADING
12#ifdef USE_PTHREADS
13#include "platform/posix/threading.h"
14#elif _WIN32
15#include "platform/windows/threading.h"
16#elif PSP2
17#include "platform/psp2/threading.h"
18#elif _3DS
19#include "platform/3ds/threading.h"
20#else
21#define DISABLE_THREADING
22#endif
23#endif
24#ifdef DISABLE_THREADING
25typedef void* Thread;
26typedef void* Mutex;
27typedef void* Condition;
28
29static inline int MutexInit(Mutex* mutex) {
30 UNUSED(mutex);
31 return 0;
32}
33
34static inline int MutexDeinit(Mutex* mutex) {
35 UNUSED(mutex);
36 return 0;
37}
38
39static inline int MutexLock(Mutex* mutex) {
40 UNUSED(mutex);
41 return 0;
42}
43
44static inline int MutexUnlock(Mutex* mutex) {
45 UNUSED(mutex);
46 return 0;
47}
48
49static inline int ConditionInit(Condition* cond) {
50 UNUSED(cond);
51 return 0;
52}
53
54static inline int ConditionDeinit(Condition* cond) {
55 UNUSED(cond);
56 return 0;
57}
58
59static inline int ConditionWait(Condition* cond, Mutex* mutex) {
60 UNUSED(cond);
61 UNUSED(mutex);
62 return 0;
63}
64
65static inline int ConditionWaitTimed(Condition* cond, Mutex* mutex, int32_t timeoutMs) {
66 UNUSED(cond);
67 UNUSED(mutex);
68 UNUSED(timeoutMs);
69 return 0;
70}
71
72static inline int ConditionWake(Condition* cond) {
73 UNUSED(cond);
74 return 0;
75}
76#endif
77
78#endif