1
0
mirror of synced 2025-01-31 03:53:44 +01:00

impr: Set name of background service thread

This commit is contained in:
WerWolv 2024-02-15 22:10:11 +01:00
parent 510ed25509
commit dfdd06b24c

View File

@ -15,6 +15,7 @@
#include <emscripten.h> #include <emscripten.h>
#endif #endif
#include <hex/api/task_manager.hpp>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <wolv/io/file.hpp> #include <wolv/io/file.hpp>
@ -1081,7 +1082,8 @@ namespace hex {
impl::s_services->emplace_back( impl::s_services->emplace_back(
unlocalizedName, unlocalizedName,
std::jthread([callback = auto(callback)](const std::stop_token &stopToken){ std::jthread([=](const std::stop_token &stopToken){
TaskManager::setCurrentThreadName(Lang(unlocalizedName));
while (!stopToken.stop_requested()) { while (!stopToken.stop_requested()) {
callback(); callback();
std::this_thread::sleep_for(std::chrono::milliseconds(50)); std::this_thread::sleep_for(std::chrono::milliseconds(50));