fix: Background service thread names

This commit is contained in:
WerWolv
2024-07-27 14:15:51 +02:00
parent d8e1284946
commit 9a973be7ba
3 changed files with 7 additions and 7 deletions

View File

@@ -1273,7 +1273,7 @@ namespace hex {
void stopServices();
}
void registerService(const UnlocalizedString &unlocalizedName, const impl::Callback &callback);
void registerService(Lang name, const impl::Callback &callback);
}
/* Network Communication Interface Registry. Allows adding new communication interface endpoints */

View File

@@ -1235,13 +1235,13 @@ namespace hex {
}
void registerService(const UnlocalizedString &unlocalizedName, const impl::Callback &callback) {
log::debug("Registered new background service: {}", unlocalizedName.get());
void registerService(Lang name, const impl::Callback &callback) {
log::debug("Registered new background service: {}", name.get());
impl::s_services->emplace_back(
unlocalizedName,
name,
std::jthread([=](const std::stop_token &stopToken){
TaskManager::setCurrentThreadName(Lang(unlocalizedName));
TaskManager::setCurrentThreadName(name);
while (!stopToken.stop_requested()) {
callback();
std::this_thread::sleep_for(std::chrono::milliseconds(50));