all repos — mgba @ 9a9381bda9c2610cba5d0fd8033d1dd00e9eb02d

mGBA Game Boy Advance Emulator

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#else
19#define DISABLE_THREADING
20#endif
21#endif
22#ifdef DISABLE_THREADING
23typedef void* Thread;
24typedef void* Mutex;
25typedef void* Condition;
26
27static inline int MutexInit(Mutex* mutex) {
28	UNUSED(mutex);
29	return 0;
30}
31
32static inline int MutexDeinit(Mutex* mutex) {
33	UNUSED(mutex);
34	return 0;
35}
36
37static inline int MutexLock(Mutex* mutex) {
38	UNUSED(mutex);
39	return 0;
40}
41
42static inline int MutexUnlock(Mutex* mutex) {
43	UNUSED(mutex);
44	return 0;
45}
46
47static inline int ConditionInit(Condition* cond) {
48	UNUSED(cond);
49	return 0;
50}
51
52static inline int ConditionDeinit(Condition* cond) {
53	UNUSED(cond);
54	return 0;
55}
56
57static inline int ConditionWait(Condition* cond, Mutex* mutex) {
58	UNUSED(cond);
59	UNUSED(mutex);
60	return 0;
61}
62
63static inline int ConditionWaitTimed(Condition* cond, Mutex* mutex, int32_t timeoutMs) {
64	UNUSED(cond);
65	UNUSED(mutex);
66	UNUSED(timeoutMs);
67	return 0;
68}
69
70static inline int ConditionWake(Condition* cond) {
71	UNUSED(cond);
72	return 0;
73}
74#endif
75
76#endif