1
0
mirror of synced 2024-11-24 07:40:17 +01:00

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));

View File

@ -111,8 +111,8 @@ namespace hex::plugin::builtin {
s_autoBackupTime = value.get<int>(0) * 30;
});
ContentRegistry::BackgroundServices::registerService("hex.builtin.background_service.network_interface", handleNetworkInterfaceService);
ContentRegistry::BackgroundServices::registerService("hex.builtin.background_service.auto_backup", handleAutoBackup);
ContentRegistry::BackgroundServices::registerService("hex.builtin.background_service.network_interface"_lang, handleNetworkInterfaceService);
ContentRegistry::BackgroundServices::registerService("hex.builtin.background_service.auto_backup"_lang, handleAutoBackup);
EventProviderDirtied::subscribe([](prv::Provider *) {
s_dataDirty = true;