6 #ifndef UTILS_CLR_THREAD_HOLDER_H 7 #define UTILS_CLR_THREAD_HOLDER_H 22 ClrThreadHolder() =
default;
25 void SetFuncLoop(std::function<
void(
void)> _func)
32 void SetFunc(std::function<
void(
void)> _func)
41 hThread = (HANDLE)_beginthreadex(0, 0, &ClrThreadHolder::func_wrapper, static_cast<void *>(
this), 0, 0);
45 bool IsRunning()
const 53 isStopRequested =
true;
56 WaitForSingleObject(hThread, INFINITE);
60 GetExitCodeThread(hThread, &exitcode);
68 ~ClrThreadHolder() {};
72 unsigned int iThreadID = 0;
73 HANDLE hThread =
nullptr;
75 std::function<void(void)> pFunc =
nullptr;
76 bool isLoopFunc =
false;
77 bool isStopRequested =
false;
78 bool isRunning =
false;
81 unsigned MyThreadFunc()
83 if (pFunc ==
nullptr) {
return 1; }
86 while (isLoopFunc && !isStopRequested);
92 static unsigned __stdcall func_wrapper(
void *o)
94 return static_cast<ClrThreadHolder *
>(o)->MyThreadFunc();
General namespace for utilities.
Definition: BulletConversions.h:9