From 3e4ee48bf16be6925b7c35ab8bd73bd962c674d8 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Fri, 1 Feb 2013 20:36:20 +0100 Subject: Fix regression regarding timers with equal end-time std::set stores Key only if Comp(Key) yields a unique result (My mistake: I was under the impression Comp is only used for the ordering). This prevents FbTk::Timers with equal end-times from actually being started. Escpecially in situation with multiple ClockTools this lead to stopped timers (see bug #3600694). Kudos to Adam Majer for enlightening discussions. --- src/FbTk/Timer.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc index 1bec893..422e9c6 100644 --- a/src/FbTk/Timer.cc +++ b/src/FbTk/Timer.cc @@ -58,8 +58,12 @@ namespace { struct TimerCompare { - bool operator() (const FbTk::Timer* a, const FbTk::Timer* b) { - return a->getEndTime() < b->getEndTime(); + // stable sort order and allows multiple timers to have + // the same end-time + bool operator() (const FbTk::Timer* a, const FbTk::Timer* b) const { + uint64_t ae = a->getEndTime(); + uint64_t be = b->getEndTime(); + return (ae < be) || (ae == be && a < b); } }; typedef std::set TimerList; -- cgit v0.11.2