mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-22 09:30:45 +00:00
core: introduce timer::rearm()
This commit is contained in:
@@ -117,6 +117,7 @@ public:
|
||||
future<> expired();
|
||||
void set_callback(callback_t&& callback);
|
||||
void arm(clock_type::time_point until, boost::optional<clock_type::duration> period = {});
|
||||
void rearm(clock_type::time_point until, boost::optional<clock_type::duration> period = {});
|
||||
void arm(clock_type::duration delta);
|
||||
void arm_periodic(clock_type::duration delta);
|
||||
bool armed() const { return _armed; }
|
||||
@@ -982,6 +983,14 @@ void timer::arm(clock_type::time_point until, boost::optional<clock_type::durati
|
||||
_queued = true;
|
||||
}
|
||||
|
||||
inline
|
||||
void timer::rearm(clock_type::time_point until, boost::optional<clock_type::duration> period) {
|
||||
if (_armed) {
|
||||
cancel();
|
||||
}
|
||||
arm(until, period);
|
||||
}
|
||||
|
||||
inline
|
||||
void timer::arm(clock_type::duration delta) {
|
||||
return arm(clock_type::now() + delta);
|
||||
|
||||
Reference in New Issue
Block a user