fix: Background service thread names
This commit is contained in:
parent
d8e1284946
commit
9a973be7ba
@ -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 */
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user