Files
XCEngine/docs/api/threading/task-system/create-task-group.md
ssdfasd d34d040563 Fix broken links in Threading API docs
Fix 14 broken cross-references in docs/api/threading/:
- lambda-task path: lambdatask -> lambda-task (5 occurrences)
- task-system-config path: tasksystemconfig -> task-system-config (6 occurrences)
- read-write-lock self-ref: readwritelock -> read-write-lock (6 occurrences)
- task-system cross-method: createtaskgroup/destroytaskgroup -> create-task-group/destroy-task-group
- thread cross-method: getcurrentid/getid -> get-current-id/get-id

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 01:30:37 +08:00

42 lines
901 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*` - 新创建的任务组指针
**线程安全:** ✅ (内部使用 SpinLock 保护)
**复杂度:** 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](destroy-task-group.md) - 销毁任务组