10#include <boost/smart_ptr/intrusive_ptr.hpp>
12#include <userver/engine/deadline.hpp>
13#include <userver/engine/exception.hpp>
14#include <userver/engine/task/cancel.hpp>
15#include <userver/engine/task/task_processor_fwd.hpp>
17USERVER_NAMESPACE_BEGIN
19namespace utils::impl {
28class TaskContextHolder;
30class DetachedTasksSyncBlock;
84 static const std::string& GetStateName(
State state);
94 void Wait()
const noexcept(
false);
100 template <
typename Rep,
typename Period>
101 void WaitFor(
const std::chrono::duration<Rep, Period>&)
const noexcept(
false);
107 template <
typename Clock,
typename Duration>
108 void WaitUntil(
const std::chrono::time_point<Clock, Duration>&)
const
138 explicit TaskBase(impl::TaskContextHolder&& context);
149 impl::TaskContext& GetContext()
const noexcept;
152 bool HasSameContext(
const TaskBase& other)
const noexcept;
155 utils::impl::WrappedCallBase& GetPayload()
const noexcept;
158 void Invalidate()
noexcept;
164 friend class impl::DetachedTasksSyncBlock;
167 boost::intrusive_ptr<impl::TaskContext> context_;
185ev::ThreadControl& GetEventThread();
190template <
typename Rep,
typename Period>
193 WaitUntil(Deadline::FromDuration(duration));
196template <
typename Clock,
typename Duration>
198 const noexcept(
false) {
199 WaitUntil(Deadline::FromTimePoint(until));