Skip to content

Commit

Permalink
Stop Watchdog early if no longer required
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTF committed Mar 13, 2024
1 parent 28366a1 commit b003651
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/util/CancellationHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ void CancellationHandle<Mode>::startWatchDogInternal() requires WatchDogEnabled
startTimeoutWindow_ = steady_clock::now();
cancellationState_.compare_exchange_strong(state, CHECK_WINDOW_MISSED,
std::memory_order_relaxed);
} else if (detail::isCancelled(state)) {
// No need to keep the watchdog running if the handle was cancelled
// already
break;
}
} while (!watchDogState_.conditionVariable_.wait_for(
lock, DESIRED_CANCELLATION_CHECK_INTERVAL,
Expand Down

0 comments on commit b003651

Please sign in to comment.