mgba/include/mgba-util/threading.h

101 lines
1.9 KiB
C
Raw Normal View History

/* Copyright (c) 2013-2015 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef THREADING_H
#define THREADING_H
#include <mgba-util/common.h>
2016-12-27 05:01:55 +00:00
CXX_GUARD_START
#ifndef DISABLE_THREADING
#ifdef USE_PTHREADS
#include <mgba-util/platform/posix/threading.h>
2018-09-14 01:12:32 +00:00
#elif defined(_WIN32)
#include <mgba-util/platform/windows/threading.h>
2018-09-14 01:12:32 +00:00
#elif defined(PSP2)
#include <mgba-util/platform/psp2/threading.h>
2018-09-14 01:12:32 +00:00
#elif defined(_3DS)
#include <mgba-util/platform/3ds/threading.h>
2018-09-14 01:12:32 +00:00
#elif defined(__SWITCH__)
#include <mgba-util/platform/switch/threading.h>
#else
#define DISABLE_THREADING
#endif
#endif
#ifdef DISABLE_THREADING
2016-01-03 18:34:25 +00:00
#ifdef _3DS
// ctrulib already has a type called Thread
#include <3ds/thread.h>
#elif defined(__SWITCH__)
#include <switch/kernel/thread.h>
2016-01-03 18:34:25 +00:00
#else
typedef void* Thread;
2016-01-03 18:34:25 +00:00
#endif
#ifdef __SWITCH__
#include <switch/kernel/mutex.h>
#else
typedef void* Mutex;
#endif
typedef void* Condition;
static inline int MutexInit(Mutex* mutex) {
UNUSED(mutex);
return 0;
}
static inline int MutexDeinit(Mutex* mutex) {
UNUSED(mutex);
return 0;
}
static inline int MutexLock(Mutex* mutex) {
UNUSED(mutex);
return 0;
}
2015-11-13 06:50:09 +00:00
static inline int MutexTryLock(Mutex* mutex) {
UNUSED(mutex);
return 0;
}
static inline int MutexUnlock(Mutex* mutex) {
UNUSED(mutex);
return 0;
}
static inline int ConditionInit(Condition* cond) {
UNUSED(cond);
return 0;
}
static inline int ConditionDeinit(Condition* cond) {
UNUSED(cond);
return 0;
}
static inline int ConditionWait(Condition* cond, Mutex* mutex) {
UNUSED(cond);
UNUSED(mutex);
return 0;
}
static inline int ConditionWaitTimed(Condition* cond, Mutex* mutex, int32_t timeoutMs) {
UNUSED(cond);
UNUSED(mutex);
UNUSED(timeoutMs);
return 0;
}
static inline int ConditionWake(Condition* cond) {
UNUSED(cond);
return 0;
}
#endif
2016-12-27 05:01:55 +00:00
CXX_GUARD_END
#endif