mirror of
https://git.tesses.org/tesses50/tessesframework.git
synced 2026-06-01 18:15:31 +00:00
Move things from crosslang to here
This commit is contained in:
@@ -6,10 +6,6 @@
|
||||
#undef min
|
||||
#elif defined(GEKKO)
|
||||
#include <ogc/mutex.h>
|
||||
#elif defined(__SWITCH__)
|
||||
extern "C" {
|
||||
#include <switch/kernel/mutex.h>
|
||||
}
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
@@ -24,8 +20,6 @@ namespace Tesses::Framework::Threading
|
||||
HANDLE mtx;
|
||||
#elif defined(GEKKO)
|
||||
mutex_t mtx;
|
||||
#elif defined(__SWITCH__)
|
||||
RMutex mtx;
|
||||
#else
|
||||
pthread_mutex_t mtx;
|
||||
pthread_mutexattr_t attr;
|
||||
@@ -36,7 +30,6 @@ namespace Tesses::Framework::Threading
|
||||
CloseHandle(mtx);
|
||||
#elif defined(GEKKO)
|
||||
LWP_MutexDestroy(mtx);
|
||||
#elif defined(__SWITCH__)
|
||||
|
||||
#else
|
||||
pthread_mutex_destroy(&mtx);
|
||||
@@ -54,8 +47,7 @@ namespace Tesses::Framework::Threading
|
||||
#elif defined(GEKKO)
|
||||
md->mtx = LWP_MUTEX_NULL;
|
||||
LWP_MutexInit(&md->mtx, true);
|
||||
#elif defined(__SWITCH__)
|
||||
rmutexInit(&md->mtx);
|
||||
|
||||
#else
|
||||
pthread_mutexattr_init(&md->attr);
|
||||
pthread_mutexattr_settype(&md->attr,PTHREAD_MUTEX_RECURSIVE);
|
||||
@@ -72,8 +64,7 @@ namespace Tesses::Framework::Threading
|
||||
WaitForSingleObject(md->mtx, INFINITE);
|
||||
#elif defined(GEKKO)
|
||||
LWP_MutexLock(md->mtx);
|
||||
#elif defined(__SWITCH__)
|
||||
rmutexLock(&md->mtx);
|
||||
|
||||
#else
|
||||
pthread_mutex_lock(&md->mtx);
|
||||
#endif
|
||||
@@ -87,8 +78,7 @@ namespace Tesses::Framework::Threading
|
||||
ReleaseMutex(md->mtx);
|
||||
#elif defined(GEKKO)
|
||||
LWP_MutexUnlock(md->mtx);
|
||||
#elif defined(__SWITCH__)
|
||||
rmutexUnlock(&md->mtx);
|
||||
|
||||
#else
|
||||
pthread_mutex_unlock(&md->mtx);
|
||||
#endif
|
||||
@@ -102,8 +92,7 @@ namespace Tesses::Framework::Threading
|
||||
return WaitForSingleObject(md->mtx, 100) == WAIT_OBJECT_0;
|
||||
#elif defined(GEKKO)
|
||||
return LWP_MutexTryLock(md->mtx) == 0;
|
||||
#elif defined(__SWITCH__)
|
||||
return rmutexTryLock(&md->mtx);
|
||||
|
||||
#else
|
||||
return pthread_mutex_trylock(&md->mtx) == 0;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user