UP
This commit is contained in:
@@ -4,10 +4,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*Thread_Func_t)(void *pArg);
|
||||
#include "SDL3/SDL.h"
|
||||
|
||||
void ThreadCreat(Thread_Func_t func, unsigned int stackSize, void *pArg);
|
||||
void ThreadStop();
|
||||
typedef int (*Thread_Func_t)(void *pArg);
|
||||
|
||||
SDL_Thread *ThreadCreat(Thread_Func_t func, char *name, void *pArg);
|
||||
|
||||
void ThreadStop(SDL_Thread *t);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,11 +1,17 @@
|
||||
#include "sim_thread.h"
|
||||
#include <windows.h>
|
||||
|
||||
#include <process.h>
|
||||
|
||||
void ThreadCreat(Thread_Func_t func, unsigned int stackSize, void *pArg) {
|
||||
_beginthread(func, stackSize, pArg);
|
||||
SDL_Thread *ThreadCreat(Thread_Func_t func, char *name, void *pArg) {
|
||||
SDL_Thread *t = SDL_CreateThread(func, name, NULL);
|
||||
if (!t) {
|
||||
SDL_Log("CreateThread: %s", SDL_GetError);
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
void ThreadStop() {
|
||||
_endthread();
|
||||
void ThreadStop(SDL_Thread *t) {
|
||||
SDL_WaitThread(t, NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user