docs: rebuild Threading API content

This commit is contained in:
2026-03-26 20:59:59 +08:00
parent 9a2d77b81d
commit 8f486611d5
78 changed files with 1648 additions and 1061 deletions

View File

@@ -1,30 +1,32 @@
# TaskGroup::Wait
公开方法,详见头文件声明
阻塞当前线程,等待任务组完成
```cpp
void Wait();
```
该方法声明于 `XCEngine/Threading/TaskGroup.h`,当前页面用于固定 `TaskGroup` 类目录下的方法级 canonical 路径。
## 行为说明
**参数:**
当前实现会等待条件变量,直到谓词 `m_pendingCount.load() == 0` 为真
**返回:** `void` - 无返回值
## 返回值
**示例:**
- 无。
```cpp
#include <XCEngine/Threading/TaskGroup.h>
## 当前实现限制
void Example() {
XCEngine::Threading::TaskGroup object;
// 根据上下文补齐参数后调用 TaskGroup::Wait(...)
(void)object;
}
```
- 当前源码里 `m_pendingCount` 会在 [AddTask](AddTask.md) 时递增,但没有任何代码路径会把它递减。
- 这意味着只要任务组里添加过任务,`Wait()` 当前就不会因为正常任务完成而返回。
- [Cancel](Cancel.md) 也不会通知条件变量,因此取消并不能唤醒这里的等待
## 使用建议
- 当前不要在生产代码中依赖这个接口实现真正的任务组同步。
- 如果你需要可靠同步,优先直接使用 [Thread::Join](../Thread/Join.md) 或更低层的锁/条件变量方案。
## 相关文档
- [返回类总览](TaskGroup.md)
- [返回模块目录](../Threading.md)
- [返回类总览](TaskGroup.md)
- [WaitFor](WaitFor.md)
- [IsComplete](IsComplete.md)