sys: Improved startup time by running startup tasks in parallel

This commit is contained in:
WerWolv
2022-09-19 16:54:19 +02:00
parent 7b61268f22
commit 4c01a749de
8 changed files with 54 additions and 25 deletions

View File

@@ -19,8 +19,8 @@ namespace hex::init {
bool loop();
void addStartupTask(const std::string &taskName, const TaskFunction &task) {
this->m_tasks.emplace_back(taskName, task);
void addStartupTask(const std::string &taskName, const TaskFunction &task, bool async) {
this->m_tasks.emplace_back(taskName, task, async);
}
private:
@@ -37,7 +37,7 @@ namespace hex::init {
std::future<bool> processTasksAsync();
std::vector<std::pair<std::string, TaskFunction>> m_tasks;
std::vector<std::tuple<std::string, TaskFunction, bool>> m_tasks;
std::string m_gpuVendor;
};

View File

@@ -9,6 +9,7 @@ namespace hex::init {
struct Task {
std::string name;
std::function<bool()> function;
bool async;
};
std::vector<Task> getInitTasks();