2026-03-26 16:45:24 +08:00
|
|
|
|
# TaskSystemConfig
|
|
|
|
|
|
|
|
|
|
|
|
**命名空间**: `XCEngine::Threading`
|
|
|
|
|
|
|
|
|
|
|
|
**类型**: `struct`
|
|
|
|
|
|
|
|
|
|
|
|
**头文件**: `XCEngine/Threading/TaskSystemConfig.h`
|
|
|
|
|
|
|
2026-03-26 20:59:59 +08:00
|
|
|
|
**描述**: 描述 `TaskSystem` 初始化参数的配置结构体。
|
2026-03-26 16:45:24 +08:00
|
|
|
|
|
|
|
|
|
|
## 概述
|
|
|
|
|
|
|
2026-03-26 20:59:59 +08:00
|
|
|
|
`TaskSystemConfig` 的字段形状已经有了商用任务系统常见的雏形:工作线程数、任务窃取、任务队列上限、profiling 开关和线程栈大小。
|
2026-03-26 16:45:24 +08:00
|
|
|
|
|
2026-03-26 20:59:59 +08:00
|
|
|
|
但需要注意的是,当前真正被 `TaskSystem::Initialize()` 使用的只有 `workerThreadCount`。
|
2026-03-26 16:45:24 +08:00
|
|
|
|
|
2026-03-26 20:59:59 +08:00
|
|
|
|
## 字段
|
2026-03-26 16:45:24 +08:00
|
|
|
|
|
2026-03-26 20:59:59 +08:00
|
|
|
|
| 字段 | 类型 | 默认值 | 当前作用 |
|
|
|
|
|
|
|------|------|--------|----------|
|
|
|
|
|
|
| `workerThreadCount` | `uint32_t` | `0` | 已使用;`0` 时回退到 `std::thread::hardware_concurrency()` |
|
|
|
|
|
|
| `enableTaskProfiling` | `bool` | `true` | 当前未使用 |
|
|
|
|
|
|
| `stealTasks` | `bool` | `true` | 当前未使用 |
|
|
|
|
|
|
| `maxTaskQueueSize` | `uint32_t` | `1024` | 当前未使用 |
|
|
|
|
|
|
| `threadStackSize` | `uint32_t` | `0` | 当前未使用 |
|
2026-03-26 16:45:24 +08:00
|
|
|
|
|
2026-03-26 20:59:59 +08:00
|
|
|
|
## 设计说明
|
|
|
|
|
|
|
|
|
|
|
|
这说明 `TaskSystem` 目前更接近“先把 API 形状搭出来”,而不是已经把所有调度策略和平台细节真正接上。
|
2026-03-26 16:45:24 +08:00
|
|
|
|
|
|
|
|
|
|
## 相关文档
|
|
|
|
|
|
|
2026-03-26 20:59:59 +08:00
|
|
|
|
- [当前模块](../Threading.md)
|
|
|
|
|
|
- [TaskSystem](../TaskSystem/TaskSystem.md)
|