Fix worst slack queue corruption (#154)

Signed-off-by: Martin Povišer <povik@cutebit.org>
This commit is contained in:
Martin Povišer 2024-12-21 01:52:09 +01:00 committed by GitHub
parent 3dd38ad159
commit c39f8ab1ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 26 additions and 24 deletions

View File

@ -265,8 +265,9 @@ WorstSlack::updateWorstSlack(Vertex *vertex,
SlackSeq &slacks, SlackSeq &slacks,
PathAPIndex path_ap_index) PathAPIndex path_ap_index)
{ {
// Do not touch the state unless queue has been initialized
if (!queue_->empty()) {
Slack slack = slacks[path_ap_index]; Slack slack = slacks[path_ap_index];
// Locking is required because ArrivalVisitor is called by multiple // Locking is required because ArrivalVisitor is called by multiple
// threads. // threads.
LockGuard lock(lock_); LockGuard lock(lock_);
@ -290,7 +291,8 @@ WorstSlack::updateWorstSlack(Vertex *vertex,
delayAsString(slack, this)); delayAsString(slack, this));
queue_->erase(vertex); queue_->erase(vertex);
} }
// checkQueue(); //checkQueue(path_ap_index);
}
} }
void void