docs: rebuild Threading API content
This commit is contained in:
@@ -1,31 +1,31 @@
|
||||
# TaskGroup::WaitFor
|
||||
|
||||
公开方法,详见头文件声明。
|
||||
在给定超时时间内等待任务组完成。
|
||||
|
||||
```cpp
|
||||
bool WaitFor(std::chrono::milliseconds timeout);
|
||||
```
|
||||
|
||||
该方法声明于 `XCEngine/Threading/TaskGroup.h`,当前页面用于固定 `TaskGroup` 类目录下的方法级 canonical 路径。
|
||||
## 行为说明
|
||||
|
||||
**参数:**
|
||||
- `timeout` - 参数语义详见头文件声明。
|
||||
当前实现使用 `condition_variable::wait_for`,等待谓词 `m_pendingCount.load() == 0`。
|
||||
|
||||
**返回:** `bool` - 返回值语义详见头文件声明。
|
||||
## 参数
|
||||
|
||||
**示例:**
|
||||
- `timeout` - 最长等待时间。
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Threading/TaskGroup.h>
|
||||
## 返回值
|
||||
|
||||
void Example() {
|
||||
XCEngine::Threading::TaskGroup object;
|
||||
// 根据上下文补齐参数后调用 TaskGroup::WaitFor(...)。
|
||||
(void)object;
|
||||
}
|
||||
```
|
||||
- 若谓词在超时前成立则返回 `true`。
|
||||
- 否则返回 `false`。
|
||||
|
||||
## 当前实现限制
|
||||
|
||||
- 与 [Wait](Wait.md) 一样,当前 `m_pendingCount` 只增不减,因此非空任务组几乎总会超时返回 `false`。
|
||||
- [Cancel](Cancel.md) 不会通知等待者,所以取消也不会帮助 `WaitFor()` 提前结束。
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [返回类总览](TaskGroup.md)
|
||||
- [返回模块目录](../Threading.md)
|
||||
- [返回类型总览](TaskGroup.md)
|
||||
- [Wait](Wait.md)
|
||||
- [GetProgress](GetProgress.md)
|
||||
|
||||
Reference in New Issue
Block a user