first commit

This commit is contained in:
2024-12-06 04:58:55 -06:00
commit 856373b396
61 changed files with 5920 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#pragma once
#if defined(GEKKO)
#include <ogc/mutex.h>
#else
#include <threads.h>
#endif
namespace Tesses::Framework::Threading
{
class Mutex {
#if defined(GEKKO)
mutex_t mtx;
#else
mtx_t mtx;
#endif
public:
Mutex();
void Lock();
void Unlock();
bool TryLock();
~Mutex();
};
}

View File

@ -0,0 +1,27 @@
#pragma once
#include <functional>
#if defined(GEKKO)
#include <ogc/lwp.h>
#else
#include <threads.h>
#endif
#include <atomic>
namespace Tesses::Framework::Threading
{
class Thread
{
std::atomic<bool> hasInvoked;
#if defined(GEKKO)
lwp_t thrd;
static void* cb(void* ptr);
#else
thrd_t thrd;
static int cb(void* ptr);
#endif
std::function<void()> fn;
public:
Thread(std::function<void()> fn);
void Join();
void Detach();
};
}