Skip to content

Commit

Permalink
Avoid sorting timers in ntcs::Chronology::load during potential timer…
Browse files Browse the repository at this point in the history
… rescheduling
  • Loading branch information
mattrm456 authored Aug 5, 2024
1 parent bf1e585 commit 794dbee
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
18 changes: 0 additions & 18 deletions groups/ntc/ntcs/ntcs_chronology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,18 +840,6 @@ bsl::string Chronology::convertToDateTime(Microseconds timeInMicroseconds)
return bsl::string(buffer);
}

bool Chronology::sortTimers(const bsl::shared_ptr<ntci::Timer>& lhs,
const bsl::shared_ptr<ntci::Timer>& rhs)
{
const bdlb::NullableValue<bsls::TimeInterval> lhsDeadline =
lhs->deadline();

const bdlb::NullableValue<bsls::TimeInterval> rhsDeadline =
rhs->deadline();

return lhsDeadline < rhsDeadline;
}

Chronology::Chronology(ntcs::Interruptor* interruptor,
bslma::Allocator* basicAllocator)
: d_object("ntcs::Chronology")
Expand Down Expand Up @@ -1407,12 +1395,6 @@ void Chronology::load(TimerVector* result) const
if (d_parent_sp) {
d_parent_sp->load(result);
}

if (!result->empty()) {
bsl::sort(result->begin(),
result->end(),
&Chronology::sortTimers);
}
}

bsl::size_t Chronology::numRegistered() const
Expand Down
5 changes: 0 additions & 5 deletions groups/ntc/ntcs/ntcs_chronology.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,6 @@ class Chronology NTSCFG_FINAL : public ntci::Chronology
/// the Unix epoch in a date/time format.
static bsl::string convertToDateTime(Microseconds timeInMicroseconds);

/// Return true if the deadline of the specified 'lhs' timer is less than
/// the deadline of the specified 'rhs' timer.
static bool sortTimers(const bsl::shared_ptr<ntci::Timer>& lhs,
const bsl::shared_ptr<ntci::Timer>& rhs);

public:
/// The time interval that is LLONG_MAX microseconds from the Unix
/// epoch.
Expand Down

0 comments on commit 794dbee

Please sign in to comment.