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
This commit is contained in:
43
docs/api/threading/task/execute.md
Normal file
43
docs/api/threading/task/execute.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# ITask::Execute
|
||||
|
||||
```cpp
|
||||
virtual void Execute() = 0
|
||||
```
|
||||
|
||||
任务执行逻辑(纯虚方法)。用户必须在派生类中实现此方法以定义任务的具体行为。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 无
|
||||
|
||||
**复杂度:** 取决于具体任务实现
|
||||
|
||||
**注意:**
|
||||
- 此方法由 TaskSystem 的工作线程调用。
|
||||
- 任务执行期间如发生未捕获异常,行为未定义。
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
class ComputeTask : public ITask {
|
||||
public:
|
||||
explicit ComputeTask(int n) : m_n(n) {}
|
||||
|
||||
void Execute() override {
|
||||
int result = 0;
|
||||
for (int i = 0; i < m_n; ++i) {
|
||||
result += i;
|
||||
}
|
||||
printf("Result: %d\n", result);
|
||||
}
|
||||
|
||||
private:
|
||||
int m_n;
|
||||
};
|
||||
|
||||
TaskSystem::Get().Submit(std::make_unique<ComputeTask>(100));
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [ITask 总览](task.md) - 返回类总览
|
||||
Reference in New Issue
Block a user