Rootex
Rootex copied to clipboard
Threadpool assigns work to the main thread if only 1 task is submitted
ThreadPool& preloadThreads = Application::GetSingleton()->getThreadPool();
Vector<Ref<Task>> preloadTasks;
progress = 1;
for (auto& path : empericalPaths)
{
Ref<Task> loadingTask(new Task([=, &progress]() {
CreateSomeResourceFile(path);
progress++;
}));
preloadTasks.push_back(loadingTask);
}
preloadTasks.push_back(Ref<Task>(new Task([]() {})));
preloadThreads.submit(preloadTasks);
We currently have to add a dummy task to get around this