28#include <seastar/core/abort_source.hh>
29#include <seastar/core/future.hh>
30#include <seastar/core/lowres_clock.hh>
31#include <seastar/core/manual_clock.hh>
33#include <seastar/util/modules.hh>
38SEASTAR_MODULE_EXPORT_BEGIN
47template <
typename Clock = steady_clock_type,
typename Rep,
typename Period>
52 sleeper(std::chrono::duration<Rep, Period> dur)
58 auto s = std::make_unique<sleeper>(dur);
60 return fut.
finally([s = std::move(s)] {});
67 virtual const char*
what() const noexcept {
68 return "Sleep is aborted";
78template <
typename Clock = steady_clock_type>
81extern template future<> sleep_abortable<steady_clock_type>(
typename steady_clock_type::duration);
82extern template future<> sleep_abortable<lowres_clock>(
typename lowres_clock::duration);
92template <
typename Clock = steady_clock_type>
95extern template future<> sleep_abortable<steady_clock_type>(
typename steady_clock_type::duration,
abort_source&);
96extern template future<> sleep_abortable<lowres_clock>(
typename lowres_clock::duration,
abort_source&);
97extern template future<> sleep_abortable<manual_clock>(
typename manual_clock::duration,
abort_source&);
99SEASTAR_MODULE_EXPORT_END
Definition: abort_source.hh:48
Definition: abort_source.hh:58
A representation of a possibly not-yet-computed value.
Definition: future.hh:1240
future< T > finally(Func &&func) noexcept
Definition: future.hh:1640
void set_value(A &&... a) noexcept
Sets the promises value.
Definition: future.hh:990
exception that is thrown when application is in process of been stopped
Definition: sleep.hh:64
virtual const char * what() const noexcept
Reports the exception reason.
Definition: sleep.hh:67
void arm(time_point until, std::optional< duration > period={}) noexcept
Seastar API namespace.
Definition: abort_on_ebadf.hh:26
future sleep_abortable(typename Clock::duration dur)
future sleep(std::chrono::duration< Rep, Period > dur)
Definition: sleep.hh:48