Files
XCSDD/docs/api/threading/task-group/wait.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- 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
2026-03-19 12:44:08 +08:00

1.1 KiB
Raw Blame History

TaskGroup::Wait

void Wait()

注意: 此方法当前为空实现/桩代码,不执行任何操作。

阻塞当前线程,等待任务组中所有任务完成。

参数:

返回:

复杂度: N/A空实现

当前状态: 此方法为空实现,不执行任何操作。由于 m_pendingCount 计数器未正确更新,此方法永远无法正常运作。

建议: 使用 WaitFor() 代替以避免永久阻塞。

示例:

TaskGroup* group = TaskSystem::Get().CreateTaskGroup();

for (int i = 0; i < 10; ++i) {
    group->AddTask([i]() {
        printf("Task %d running\n", i);
    });
}

printf("Waiting for all tasks...\n");
// 注意Wait() 为空实现,建议使用 WaitFor()
if (group->WaitFor(std::chrono::seconds(5))) {
    printf("All tasks completed within 5 seconds\n");
} else {
    printf("Timeout! Tasks may not have completed\n");
}

TaskSystem::Get().DestroyTaskGroup(group);

相关文档