squall/storm/thread/S_Thread.hpp

58 lines
1.2 KiB
C++
Raw Normal View History

2020-09-09 00:45:46 -05:00
#ifndef STORM_THREAD_S__THREAD_HPP
#define STORM_THREAD_S__THREAD_HPP
2020-11-01 17:45:45 -06:00
#include "storm/thread/SThread.hpp"
2020-09-09 00:45:46 -05:00
#include <cstdint>
#if defined(WHOA_SYSTEM_WIN)
#include <windows.h>
#endif
2020-09-09 00:45:46 -05:00
typedef SThread SyncObjectData;
struct SThreadParmBlock {
uint32_t (*threadProc)(void*);
void* threadParam;
uint32_t threadID;
#if defined(WHOA_SYSTEM_WIN)
HANDLE threadH;
#endif
#if defined(WHOA_SYSTEM_MAC) || defined(WHOA_SYSTEM_LINUX)
2020-09-09 00:45:46 -05:00
SyncObjectData* syncObject;
#endif
2020-09-09 00:45:46 -05:00
};
class S_Thread {
public:
// Types
struct SThreadTrack {
int32_t suspended;
int32_t live;
uint32_t threadId;
#if defined(WHOA_SYSTEM_WIN)
HANDLE threadH;
#endif
2020-09-09 00:45:46 -05:00
char name[16];
};
// Static variables
static int32_t s_numthreads;
static int32_t s_maxthreads;
static uint32_t s_threadID;
static SThreadTrack s_threads[1024];
// Static functions
#if defined(WHOA_SYSTEM_WIN)
2024-11-14 21:59:05 -08:00
static DWORD WINAPI s_SLaunchThread(void* threadParam);
#endif
#if defined(WHOA_SYSTEM_MAC)
static uint32_t s_SLaunchThread(void* threadParam);
#endif
#if defined(WHOA_SYSTEM_LINUX)
static void* s_SLaunchThread(void* threadParam);
#endif
2020-09-09 00:45:46 -05:00
};
#endif