Skip to content

Commit 2b8b5a5

Browse files
committed
dmclock/src/dmclock_server: no need for PriorityQueueBase::cleaning_job to be a unique_ptr
Signed-off-by: Samuel Just <[email protected]>
1 parent faa6c0f commit 2b8b5a5

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/dmclock/src/dmclock_server.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ namespace crimson {
826826

827827
// NB: All threads declared at end, so they're destructed first!
828828

829-
std::unique_ptr<RunEvery> cleaning_job;
829+
RunEvery cleaning_job;
830830

831831
// helper function to return the value of a variant if it matches the
832832
// given type T, or a default value of T otherwise
@@ -852,16 +852,13 @@ namespace crimson {
852852
idle_age(std::chrono::duration_cast<Duration>(_idle_age)),
853853
erase_age(std::chrono::duration_cast<Duration>(_erase_age)),
854854
check_time(std::chrono::duration_cast<Duration>(_check_time)),
855-
erase_max(standard_erase_max)
855+
erase_max(standard_erase_max),
856+
cleaning_job(check_time, std::bind(&PriorityQueueBase::do_clean, this))
856857
{
857858
assert(_erase_age >= _idle_age);
858859
assert(_check_time < _idle_age);
859860
// AtLimit::Reject depends on ImmediateTagCalc
860861
assert(at_limit != AtLimit::Reject || !IsDelayed);
861-
cleaning_job =
862-
std::unique_ptr<RunEvery>(
863-
new RunEvery(check_time,
864-
std::bind(&PriorityQueueBase::do_clean, this)));
865862
}
866863

867864
inline const ClientInfo* get_cli_info(ClientRec& client) const {
@@ -1248,7 +1245,7 @@ namespace crimson {
12481245
// clean finished, refresh
12491246
last_erase_point = 0;
12501247
}
1251-
cleaning_job->try_update(wperiod);
1248+
cleaning_job.try_update(wperiod);
12521249
} // if
12531250
} // do_clean
12541251

0 commit comments

Comments
 (0)