docs: update memory and threading API docs

This commit is contained in:
2026-03-20 02:35:24 +08:00
parent c5b17239ca
commit fd792b7df1
103 changed files with 2485 additions and 673 deletions

View File

@@ -0,0 +1,50 @@
# TaskGroup::GetProgress
```cpp
float GetProgress() const;
```
获取任务组的完成进度。
**参数:**
**返回:**
- `float` - 0.0 到 1.0 之间的进度值0.0 表示没有任务或都没有完成1.0 表示全部完成
**线程安全:** ✅ 线程安全
**示例:**
```cpp
#include "XCEngine/Threading/TaskGroup.h"
#include "XCEngine/Threading/Task.h"
#include <iostream>
#include <chrono>
using namespace XCEngine::Threading;
int main() {
TaskGroup group;
for (int i = 0; i < 4; ++i) {
group.AddTask([i]() {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
});
}
while (!group.IsComplete()) {
float progress = group.GetProgress();
std::cout << "Progress: " << (progress * 100) << "%\n";
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
std::cout << "Final Progress: " << (group.GetProgress() * 100) << "%\n";
return 0;
}
```
## 相关文档
- [TaskGroup 总览](task-group.md) - 返回类总览
- [IsComplete](is-complete.md) - 检查是否完成