Make threading and networking optional
This commit is contained in:
@ -1,22 +1,10 @@
|
||||
#pragma once
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(GEKKO)
|
||||
#include <ogc/mutex.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#include "../HiddenField.hpp"
|
||||
namespace Tesses::Framework::Threading
|
||||
{
|
||||
class Mutex {
|
||||
#if defined(_WIN32)
|
||||
HANDLE mtx;
|
||||
#elif defined(GEKKO)
|
||||
mutex_t mtx;
|
||||
#else
|
||||
pthread_mutex_t mtx;
|
||||
pthread_mutexattr_t attr;
|
||||
#endif
|
||||
HiddenField data;
|
||||
public:
|
||||
Mutex();
|
||||
void Lock();
|
||||
|
||||
@ -8,26 +8,13 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <atomic>
|
||||
#include "../HiddenField.hpp"
|
||||
namespace Tesses::Framework::Threading
|
||||
{
|
||||
class Thread
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
|
||||
HANDLE thrd;
|
||||
DWORD thrdId;
|
||||
|
||||
public:
|
||||
#elif defined(GEKKO)
|
||||
lwp_t thrd;
|
||||
static void* cb(void* ptr);
|
||||
#else
|
||||
pthread_t thrd;
|
||||
static void* cb(void* ptr);
|
||||
#endif
|
||||
std::function<void()> fn;
|
||||
|
||||
std::atomic<bool> hasInvoked;
|
||||
HiddenField data;
|
||||
|
||||
public:
|
||||
Thread(std::function<void()> fn);
|
||||
void Join();
|
||||
|
||||
Reference in New Issue
Block a user