Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid sorting timers in ntcs::Chronology::load during potential timer rescheduling #204

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading