| 147 | } |
| 148 | |
| 149 | void Task::Execute() |
| 150 | { |
| 151 | if (!IsQueued()) |
| 152 | return; |
| 153 | SetState(TaskState::Running); |
| 154 | |
| 155 | // Perform an operation |
| 156 | bool failed = Run(); |
| 157 | |
| 158 | // Process result |
| 159 | if (IsCancelRequested()) |
| 160 | { |
| 161 | SetState(TaskState::Canceled); |
| 162 | } |
| 163 | else if (failed) |
| 164 | { |
| 165 | OnFail(); |
| 166 | } |
| 167 | else |
| 168 | { |
| 169 | OnFinish(); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | void Task::OnStart() |
| 174 | { |
no test coverage detected