15void Start(BaseCore*
head, IExecutor&
e)
noexcept;
24template <
typename V,
typename E>
29 static_assert(
Check<V>(),
"V should be valid");
30 static_assert(
Check<E>(),
"E should be valid");
31 static_assert(!std::is_same_v<V, E>,
"Task cannot be instantiated with same V and E, because it's ambiguous");
47 return _core !=
nullptr;
57 return !_core->Empty();
66 return {std::move(this->_core)};
69 template <
typename Func>
72 static constexpr auto CoreT = CoreType::ToUnique | CoreType::Call | CoreType::Lazy;
73 return detail::SetCallback<CoreT, false>(_core, &
e, std::forward<Func>(
f));
75 template <
typename Func>
78 static constexpr auto CoreT = CoreType::ToUnique | CoreType::Lazy;
79 return detail::SetCallback<CoreT, false>(_core,
nullptr, std::forward<Func>(
f));
81 template <
typename Func>
84 static constexpr auto CoreT = CoreType::ToUnique | CoreType::Call | CoreType::Lazy;
85 return detail::SetCallback<CoreT, false>(_core,
nullptr, std::forward<Func>(
f));
94 auto* core = _core.Release();
100 auto* core = _core.Release();
108 return {std::move(_core)};
113 return {std::move(_core)};
118 return std::move(*this).ToFuture().Get();
130 auto core = std::exchange(_core,
nullptr);
131 return std::move(core->Get());
146 detail::UniqueCorePtr<V, E> _core;
149extern template class Task<>;
Provides a mechanism to access the result of async operations.
Provides a mechanism to access the result of async operations.
A intrusive pointer to objects with an embedded reference count.
Encapsulated return value from caller.
Provides a mechanism to schedule the some async operations TODO(MBkkt) add description.
Task & operator=(const Task &)=delete
Result< V, E > Touch() &&noexcept
auto ThenInline(Func &&f) &&
bool Ready() const &noexcept
Check that Result that corresponds to this Task is computed.
void Touch() const &&=delete
detail::UniqueCorePtr< V, E > & GetCore() noexcept
Method that get internal Core state.
Task< V, E > On(std::nullptr_t) &&noexcept
Do nothing, just for compatibility with FutureOn TODO(MBkkt) think about force On/Detach/ToFuture: It...
Task(detail::UniqueCorePtr< V, E > core) noexcept
Task(Task &&other) noexcept=default
void Detach(IExecutor &e) &&noexcept
bool Valid() const &noexcept
Future< V, E > ToFuture() &&noexcept
Result< V, E > Get() &&noexcept
auto Then(IExecutor &e, Func &&f) &&
Task(const Task &)=delete
FutureOn< V, E > ToFuture(IExecutor &e) &&noexcept
Task & operator=(Task &&other) noexcept=default
#define YACLIB_ASSERT(cond)
InlineCore & MakeDrop() noexcept
void Start(BaseCore *head, IExecutor &e) noexcept
IExecutor & MakeInline() noexcept
Get Inline executor singleton object.
Contract< V, E > MakeContract()
Creates related future and promise.