From 153c5a5bda1749fecbe52572fbba948938078d60 Mon Sep 17 00:00:00 2001 From: Kurt Wilson Date: Thu, 9 Nov 2023 18:09:28 -0500 Subject: [PATCH] use priority as tiebreaker in EDF mode --- src/priority_executor/src/priority_memory_strategy.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/priority_executor/src/priority_memory_strategy.cpp b/src/priority_executor/src/priority_memory_strategy.cpp index 383d698..ba42379 100644 --- a/src/priority_executor/src/priority_memory_strategy.cpp +++ b/src/priority_executor/src/priority_memory_strategy.cpp @@ -113,12 +113,14 @@ bool PriorityExecutableComparator::operator()(const PriorityExecutable *p1, cons { p2_deadline = p2->deadlines->front(); } - if (p1_deadline == p2_deadline) + if (p1_deadline == p2_deadline || p1->deadlines == p2->deadlines) { // this looks bad and is bad, BUT // if we tell std::set these are equal, only one will be added, and we will lose the other. // we need _something_ to make them unique - return p1->executable_id < p2->executable_id; + // since we'd rather finish a chain than start a new one, select the higher id + // return p1->executable_id > p2->executable_id; + return p1->priority < p2->priority; } if (p1_deadline == 0) {