- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
860 B
860 B
TaskGroup::WaitFor
bool WaitFor(std::chrono::milliseconds timeout)
等待任务组中所有任务完成,可在超时后返回。
参数:
timeout- 最大等待时间
返回: bool - 所有任务在超时前完成返回 true,超时返回 false
复杂度: O(n)
示例:
TaskGroup* group = TaskSystem::Get().CreateTaskGroup();
for (int i = 0; i < 5; ++i) {
group->AddTask([i]() {
Thread::Sleep(i * 100);
printf("Task %d done\n", i);
});
}
if (group->WaitFor(std::chrono::seconds(1))) {
printf("All tasks completed within 1 second\n");
} else {
printf("Timeout! Some tasks still running\n");
printf("Progress: %.1f%%\n", group->GetProgress() * 100.0f);
}
相关文档
- TaskGroup 总览 - 返回类总览
- Wait - 无超时等待