docs: 修正 API 文档准确性 (第四轮检查)

修复问题:
- containers: HashMap 实现描述修正
- debug: XE_LOG 宏参数顺序修正
- memory: ProxyAllocator 统计示例修正, PoolAllocator allocate size 检查描述
- resources: ResourceManager 缺失 UnloadGroup 方法
- rhi: D3D12 格式枚举名称修正, Texture Format 枚举补全, ResourceStates 补充
- threading: TaskGroup GetProgress/Wait/Cancel 实现限制说明
This commit is contained in:
2026-03-19 00:43:16 +08:00
parent 870cb3116e
commit 82cf147817
13 changed files with 41 additions and 21 deletions

View File

@@ -15,7 +15,8 @@ void Cancel()
**注意:**
- 已完成的任务不受影响。
- 正在执行的任务继续执行直到完成。
- 调用后所有 Wait/WaitFor 会立即返回。
- 调用后所有 Wait/WaitFor 会立即返回(但请参见下方警告)
- **警告**`Cancel()` 调用 `OnCancel()` 后不会减少待完成任务数,因此如果任务组中还有未执行的任务,调用 `Wait()` 会导致永久阻塞。建议在 `Cancel()` 后使用 `IsComplete()` 轮询或使用带超时的 `WaitFor()`
**示例:**

View File

@@ -12,6 +12,8 @@ float GetProgress() const
**复杂度:** O(1)
**注意:** 当前实现中 `m_completedCount` 未被更新,此方法始终返回 0.0f(任务组为空时返回 1.0f)。此为实现限制。
**示例:**
```cpp
@@ -21,13 +23,10 @@ for (int i = 0; i < 1000; ++i) {
group->AddTask([i]() { ProcessItem(i); });
}
// 显示进度
// 显示进度(注意:当前实现始终返回 0.0f
while (!group->IsComplete()) {
float progress = group->GetProgress();
printf("\rLoading: [%-50s] %.1f%%",
std::string(50, '=').substr(0, (int)(progress * 50)).c_str(),
progress * 100.0f);
fflush(stdout);
printf("\rProgress: %.1f%%", progress * 100.0f);
Thread::Sleep(100);
}
printf("\n");

View File

@@ -12,7 +12,10 @@ void Wait()
**复杂度:** O(n)n 为任务数量
**注意:** 如果任务组已被取消,此方法将立即返回。
**注意:**
- 如果任务组已被取消,此方法将立即返回。
- 如果任务组中还有未执行且未被取消的任务,调用此方法将永久阻塞(这是当前实现的限制)。
- 建议使用 `WaitFor()` 代替以避免永久阻塞。
**示例:**