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 MutexTryLock(Mutex* mutex) {
45 UNUSED(mutex);
46 return 0;
47}
48
49static inline int MutexUnlock(Mutex* mutex) {
50 UNUSED(mutex);
51 return 0;
52}
53
54static inline int ConditionInit(Condition* cond) {
55 UNUSED(cond);
56 return 0;
57}
58
59static inline int ConditionDeinit(Condition* cond) {
60 UNUSED(cond);
61 return 0;
62}
63
64static inline int ConditionWait(Condition* cond, Mutex* mutex) {
65 UNUSED(cond);
66 UNUSED(mutex);
67 return 0;
68}
69
70static inline int ConditionWaitTimed(Condition* cond, Mutex* mutex, int32_t timeoutMs) {
71 UNUSED(cond);
72 UNUSED(mutex);
73 UNUSED(timeoutMs);
74 return 0;
75}
76
77static inline int ConditionWake(Condition* cond) {
78 UNUSED(cond);
79 return 0;
80}
81#endif
82
83#endif