Files
XCSDD/docs/api/threading/task-system/createtaskgroup.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- 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
2026-03-19 12:44:08 +08:00

40 lines
843 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TaskSystem::CreateTaskGroup
```cpp
TaskGroup* CreateTaskGroup()
```
创建一个任务组用于批量管理多个任务。
**参数:**
**返回:** `TaskGroup*` - 新创建的任务组指针
**复杂度:** O(1)
**注意:**
- 任务组必须通过 DestroyTaskGroup 显式销毁。
- 任务组的所有权归调用者TaskSystem 不负责销毁。
**示例:**
```cpp
TaskGroup* group = TaskSystem::Get().CreateTaskGroup();
group->AddTask([]() { LoadTextures(); });
group->AddTask([]() { LoadModels(); });
group->AddTask([]() { LoadAudio(); });
group->SetCompleteCallback([]() {
printf("All resources loaded!\n");
});
group->Wait();
TaskSystem::Get().DestroyTaskGroup(group);
```
## 相关文档
- [TaskSystem 总览](task-system.md) - 返回类总览
- [DestroyTaskGroup](destroytaskgroup.md) - 销毁任务组