10#include <userver/engine/deadline.hpp>
11#include <userver/engine/future_status.hpp>
12#include <userver/engine/task/cancel.hpp>
13#include <userver/engine/task/current_task.hpp>
14#include <userver/utils/fast_pimpl.hpp>
16USERVER_NAMESPACE_BEGIN
18namespace utils::impl {
24class TaskContextHolder;
26class DetachedTasksSyncBlock;
80 static std::string_view GetStateName(State state);
90 void Wait()
const noexcept(
false);
96 template <
typename Rep,
typename Period>
97 void WaitFor(
const std::chrono::duration<Rep, Period>&)
const noexcept(
false);
103 template <
typename Clock,
typename Duration>
104 void WaitUntil(
const std::chrono::time_point<Clock, Duration>&)
const noexcept(
false);
146 explicit TaskBase(impl::TaskContextHolder&& context);
157 impl::TaskContext& GetContext()
const noexcept;
160 bool HasSameContext(
const TaskBase& other)
const noexcept;
163 utils::impl::WrappedCallBase& GetPayload()
const noexcept;
166 void Invalidate()
noexcept;
172 friend class impl::DetachedTasksSyncBlock;
176 utils::FastPimpl<Impl, 8, 8> pimpl_;
179template <
typename Rep,
typename Period>
180void TaskBase::
WaitFor(
const std::chrono::duration<Rep, Period>& duration)
const noexcept(
false) {
181 WaitUntil(Deadline::FromDuration(duration));
184template <
typename Clock,
typename Duration>
185void TaskBase::
WaitUntil(
const std::chrono::time_point<Clock, Duration>& until)
const noexcept(
false) {
186 WaitUntil(Deadline::FromTimePoint(until));