- 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
837 B
837 B
ITask::Execute
virtual void Execute() = 0
任务执行逻辑(纯虚方法)。用户必须在派生类中实现此方法以定义任务的具体行为。
参数: 无
返回: 无
复杂度: 取决于具体任务实现
注意:
- 此方法由 TaskSystem 的工作线程调用。
- 任务执行期间如发生未捕获异常,行为未定义。
示例:
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 总览 - 返回类总览