Small fix

This commit is contained in:
Federico Cecchetto 2022-06-12 03:43:18 +02:00
parent 1cd309f299
commit 2e653dbbbf
2 changed files with 17 additions and 1 deletions

View File

@ -12,6 +12,7 @@ namespace scheduler
namespace
{
utils::hook::detour server_frame_hook;
bool kill_thread = false;
struct task
{
@ -143,7 +144,7 @@ namespace scheduler
{
thread = std::thread([]()
{
while (true)
while (!kill_thread)
{
execute(pipeline::async);
std::this_thread::sleep_for(10ms);
@ -152,6 +153,16 @@ namespace scheduler
server_frame_hook.create(SELECT_VALUE(0x43E340, 0x46B680), server_frame_stub);
}
void pre_destroy() override
{
kill_thread = true;
if (thread.joinable())
{
thread.join();
}
}
};
}

View File

@ -13,5 +13,10 @@ BOOL APIENTRY DllMain(HMODULE /*module_*/, DWORD ul_reason_for_call, LPVOID /*re
component_loader::post_unpack();
}
if (ul_reason_for_call == DLL_PROCESS_DETACH)
{
component_loader::pre_destroy();
}
return TRUE;
}