threading/: - Rename 19 camelCase method files to hyphenated names - task-system: createtaskgroup→create-task-group, etc. - tasksystemconfig: enabletaskprofiling→enable-task-profiling, etc. - thread: getcurrentid→get-current-id, etc. - task: addref→add-ref, getid→get-id, etc. math/: - Rename underscore operator files to hyphenated - vector3: operator_add→operator-add, etc. - matrix4: gettranslation→get-translation, etc. - vector4: tovector3→to-vector3, constructor_vector3→constructor-vector3 - sphere: sphere_constructor→sphere-constructor, etc. memory/: - Remove duplicate memorymanager/ folder (kept manager/ which was correct) core/: - filewriter: Consolidate ctor-default.md and ctor-file.md into constructor.md - Rename dtor.md→destructor.md debug/: - filelogsink: Rename construct.md→constructor.md, ~filelogsink.md→destructor.md All overview pages updated with new file references.
632 B
632 B
ITask::SetStatus
void SetStatus(TaskStatus status)
设置任务的当前状态。
参数:
status- 新的状态(参见 TaskStatus 枚举)
返回: 无
复杂度: O(1)
注意: 正常情况下由 TaskSystem 管理状态。手动设置状态可能干扰任务系统的正常调度。
示例:
class ConditionalTask : public ITask {
public:
void Execute() override {
if (someCondition) {
SetStatus(TaskStatus::Failed);
return;
}
// 正常处理
}
};
相关文档
- ITask 总览 - 返回类总览