Skip to content

Commit

Permalink
fix interrupt n
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsnolde committed Mar 12, 2024
1 parent ab09bf9 commit f80b465
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/thor/costmatrix.cc
Expand Up @@ -166,6 +166,7 @@ bool CostMatrix::SourceToTarget(Api& request,
// search from all source locations. Connections between the 2 search
// spaces is checked during the forward search.
uint32_t n = 0;
uint32_t interrupt_n = 0;
while (true) {
// First iterate over all targets, then over all sources: we only for sure
// check the connection between both trees on the forward search, so reverse
Expand Down Expand Up @@ -252,7 +253,7 @@ bool CostMatrix::SourceToTarget(Api& request,
throw valhalla_exception_t{430};
}
// Allow this process to be aborted
if (interrupt_ && (n % kInterruptIterationsInterval) == 0) {
if (interrupt_ && (interrupt_n++ % kInterruptIterationsInterval) == 0) {
(*interrupt_)();
}
n++;
Expand Down

0 comments on commit f80b465

Please sign in to comment.