- 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
47 lines
1.1 KiB
Markdown
47 lines
1.1 KiB
Markdown
# TaskGroup::Wait
|
||
|
||
```cpp
|
||
void Wait()
|
||
```
|
||
|
||
**注意:** 此方法当前为**空实现/桩代码**,不执行任何操作。
|
||
|
||
阻塞当前线程,等待任务组中所有任务完成。
|
||
|
||
**参数:** 无
|
||
|
||
**返回:** 无
|
||
|
||
**复杂度:** N/A(空实现)
|
||
|
||
**当前状态:** 此方法为空实现,不执行任何操作。由于 `m_pendingCount` 计数器未正确更新,此方法永远无法正常运作。
|
||
|
||
**建议:** 使用 `WaitFor()` 代替以避免永久阻塞。
|
||
|
||
**示例:**
|
||
|
||
```cpp
|
||
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);
|
||
```
|
||
|
||
## 相关文档
|
||
|
||
- [TaskGroup 总览](task-group.md) - 返回类总览
|
||
- [WaitFor](waitfor.md) - 超时等待
|