Skip to content

Commit

Permalink
Named timer state always ECANCELED if canceled. (#1635)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barenboim authored Oct 12, 2024
1 parent 7941248 commit efdba8a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/factory/WFTaskFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,16 @@ void __WFNamedTimerTask::dispatch()

void __WFNamedTimerTask::handle(int state, int error)
{
bool canceled = true;

if (node_.task)
{
bool erased = false;

__timer_map.mutex_.lock();
if (node_.task)
{
canceled = false;
erased = timers_->del(&node_, &__timer_map.root_);
node_.task = NULL;
}
Expand All @@ -254,6 +257,12 @@ void __WFNamedTimerTask::handle(int state, int error)
delete timers_;
}

if (canceled)
{
state = SS_STATE_ERROR;
error = ECANCELED;
}

mutex_.lock();
mutex_.unlock();
this->__WFTimerTask::handle(state, error);
Expand Down

0 comments on commit efdba8a

Please sign in to comment.