Optimize timed thread/go task's state when timer failed.

This commit is contained in:
Xie Han
2023-10-17 21:21:42 +08:00
parent aebd704e05
commit 9c93192bb4
2 changed files with 22 additions and 4 deletions

View File

@@ -847,8 +847,17 @@ void __WFTimedGoTask::timer_callback(WFTimerTask *timer)
if (--task->ref == 3)
{
task->state = WFT_STATE_SYS_ERROR;
task->error = ETIMEDOUT;
if (timer->get_state() == WFT_STATE_SUCCESS)
{
task->state = WFT_STATE_SYS_ERROR;
task->error = ETIMEDOUT;
}
else
{
task->state = timer->get_state();
task->error = timer->get_error();
}
task->subtask_done();
}

View File

@@ -820,8 +820,17 @@ void __WFTimedThreadTask<INPUT, OUTPUT>::timer_callback(WFTimerTask *timer)
if (--task->ref == 3)
{
task->state = WFT_STATE_SYS_ERROR;
task->error = ETIMEDOUT;
if (timer->get_state() == WFT_STATE_SUCCESS)
{
task->state = WFT_STATE_SYS_ERROR;
task->error = ETIMEDOUT;
}
else
{
task->state = timer->get_state();
task->error = timer->get_error();
}
task->subtask_done();
}