#include "../cdb_sustem.h" #include struct threadInfo{ sus_threadProc proc; void * args; }; DWORD WINAPI threadProc(void * tiarg){ struct threadInfo * ti = tiarg; struct threadInfo currentTI = {.args = ti->args, .proc = ti->proc}; sus_heapFree(ti); currentTI.proc(currentTI.args); return 0; } sus_Bool sus_threadNew(sus_threadProc proc, void * arg){ struct threadInfo * ti = sus_heapAlloc(sizeof(struct threadInfo)); ti->proc = proc; ti->args = arg; if(CreateThread(NULL, 0, threadProc, ti, 0, NULL) == NULL){ sus_heapFree(ti); return sus_False; }else{ return sus_True; } } void sus_threadSleep(unsigned long seconds){ Sleep(seconds * 1000); }