sys: Replaced awful task system with a much more efficient thread pool

This commit is contained in:
WerWolv
2022-10-04 23:37:48 +02:00
parent 26be4c3ac8
commit 7bb9e7ee82
9 changed files with 210 additions and 142 deletions

View File

@@ -61,7 +61,7 @@ namespace hex::init {
try {
if (async) {
std::thread(runTask).detach();
TaskManager::createBackgroundTask(name, [runTask](auto&){ runTask(); });
} else {
runTask();
}

View File

@@ -33,6 +33,7 @@ int main(int argc, char **argv, char **envp) {
init::WindowSplash splashWindow;
TaskManager::init();
for (const auto &[name, task, async] : init::getInitTasks())
splashWindow.addStartupTask(name, task, async);
@@ -44,6 +45,7 @@ int main(int argc, char **argv, char **envp) {
ON_SCOPE_EXIT {
for (const auto &[name, task, async] : init::getExitTasks())
task();
TaskManager::exit();
};
// Main window