- Rename D3D12Enum.h to D3D12Enums.h for naming consistency - Fix OpenGL unit test GLAD initialization by using gladLoadGL() instead of gladLoadGLLoader(wglGetProcAddress) for fallback support - Migrate remaining tests to use gtest_discover_tests for granular test discovery (math, core, containers, memory, threading, debug, components, scene, resources, input, opengl) - Remove obsolete TEST_RESOURCES_DIR and copy_directory commands from OpenGL unit test CMakeLists (minimal/Res doesn't exist) - Update TEST_SPEC.md with performance metrics and per-module build/test commands for faster development workflow - Update CMake path references to use lowercase paths
42 lines
961 B
Markdown
42 lines
961 B
Markdown
# LambdaTask::LambdaTask
|
||
|
||
```cpp
|
||
explicit LambdaTask(Func&& func, TaskPriority priority = TaskPriority::Normal)
|
||
```
|
||
|
||
构造 Lambda 任务对象,将可调用对象包装为 ITask。
|
||
|
||
**模板参数:**
|
||
- `Func` - 可调用对象类型
|
||
|
||
**参数:**
|
||
- `func` - 要封装的可调用对象(lambda、函数指针、std::function 等)
|
||
- `priority` - 任务优先级,默认值为 TaskPriority::Normal
|
||
|
||
**返回:** 无
|
||
|
||
**复杂度:** O(1)
|
||
|
||
**示例:**
|
||
|
||
```cpp
|
||
// 使用 std::function lambda
|
||
auto task = std::make_unique<LambdaTask<std::function<void()>>>(
|
||
[]() { printf("Task executed\n"); },
|
||
TaskPriority::High
|
||
);
|
||
TaskSystem::Get().Submit(std::move(task));
|
||
|
||
// 配合 TaskSystem::Submit 的重载直接使用
|
||
TaskSystem::Get().Submit(
|
||
std::make_unique<LambdaTask<std::function<void()>>>(
|
||
[]() { ProcessData(); },
|
||
TaskPriority::Critical
|
||
)
|
||
);
|
||
```
|
||
|
||
## 相关文档
|
||
|
||
- [LambdaTask 总览](lambdatask.md) - 返回类总览
|