1
0
mirror of synced 2025-02-17 18:59:21 +01:00

feat: log exit tasks to console (#1363)

This commit is contained in:
iTrooz 2023-10-11 22:38:54 +02:00 committed by GitHub
parent afa149f2db
commit b908965048
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View File

@ -12,6 +12,11 @@ namespace hex::init {
bool async;
};
/**
* @brief Runs the exit tasks and print them to console
*/
void runExitTasks();
std::vector<Task> getInitTasks();
std::vector<Task> getExitTasks();
}

View File

@ -76,8 +76,7 @@ namespace hex::crash {
EventManager::post<EventAbnormalTermination>(signalNumber);
// Run exit tasks
for (const auto &[name, task, async] : init::getExitTasks())
task();
init::runExitTasks();
// Terminate all asynchronous tasks
TaskManager::exit();

View File

@ -608,6 +608,14 @@ namespace hex::init {
return true;
}
// run all exit taks, and print to console
void runExitTasks() {
for (const auto &[name, task, async] : init::getExitTasks()) {
task();
log::info("Finished exit task {}", name);
}
}
std::vector<Task> getInitTasks() {
return {
{ "Setting up environment", setupEnvironment, false },

View File

@ -95,8 +95,7 @@ namespace {
*/
void deinitializeImHex() {
// Run exit tasks
for (const auto &[name, task, async] : init::getExitTasks())
task();
init::runExitTasks();
// Terminate all asynchronous tasks
TaskManager::exit();