62 inline bool cancel() noexcept;
76 success =
state.compare_exchange_weak(
79 std::memory_order_relaxed,
80 std::memory_order_relaxed
113 if (
this != ice::addressof(other))
123 if (
this != ice::addressof(other))
133 bool success =
false;
134 if (
_info !=
nullptr)
141 template<
typename Result>
148 template<typename... Args>
154 handle._info->release();
156 handle._info = _info->
aquire();
159 template<
typename Class,
typename... Args>
165 handle._info->release();
167 handle._info = _info->
aquire();
172 if (
_info !=
nullptr)
184 template<
typename Promise>
214 if (this->_info !=
nullptr)
247template<
typename Result,
typename... Args>
254template<
typename Result,
typename Class,
typename... Args>
#define ICE_ASSERT_CORE(expression)
Definition assert_core.hxx:43
Definition task_promise.hxx:13
Definition hashmap_details.hxx:13
bool try_set_canceled_state(std::atomic< ice::TaskState > &state) noexcept
Definition task_handle.hxx:70
SPDX-License-Identifier: MIT.
Definition array.hxx:12
TaskState
All states a task can be in.
Definition task_info.hxx:13
@ Canceled
Task was canceled at any point of it's lifetime.
Definition task_info.hxx:32
@ Created
Task exists, but execution did not start.
Definition task_info.hxx:20
@ Invalid
Special state from TaskHandles, handle is not initialized.
Definition task_info.hxx:17
@ Running
Task, or one of it's subtasks are executing.
Definition task_info.hxx:23
@ Succeeded
Task finished execution with a valid result.
Definition task_info.hxx:29
@ None
Special state from TaskHandles, handle is not initialized.
Definition task_info.hxx:15
@ Suspended
Task is suspended and awaits resuming. (Unused).
Definition task_info.hxx:26
@ Failed
Task finished execution but results are invalid.
Definition task_info.hxx:35
constexpr bool has_any(T value, T expected_flags) noexcept
Definition enum_flags.hxx:83
std::coroutine_handle< Type > coroutine_handle
Definition task_types.hxx:42
ice::Expected< ice::ErrorCode > Result
Definition expected.hxx:197
Special handle accessing task information at runtime.
Definition task_handle.hxx:16
TaskHandle() noexcept
Definition task_handle.hxx:94
~TaskHandle() noexcept
Definition task_handle.hxx:106
ice::TaskInfo * _info
Definition task_handle.hxx:64
bool has_finished() const noexcept
Definition task_handle.hxx:50
auto state() const noexcept
Definition task_handle.hxx:26
bool is_suspended() const noexcept
Definition task_handle.hxx:42
bool was_cancelled() const noexcept
Definition task_handle.hxx:46
bool has_succeded() const noexcept
Definition task_handle.hxx:54
bool is_running() const noexcept
Definition task_handle.hxx:37
auto operator=(TaskHandle &&other) noexcept -> TaskHandle &
Definition task_handle.hxx:111
bool cancel() noexcept
Sends a cancel request to the connected task.
Definition task_handle.hxx:131
bool has_failed() const noexcept
Definition task_handle.hxx:58
bool is_valid() const noexcept
Definition task_handle.hxx:33
Definition task_info.hxx:50
bool has_any(ice::TaskState state) const noexcept
Definition task_info.hxx:87
std::atomic< ice::TaskState > state
Definition task_info.hxx:65
auto aquire() noexcept -> ice::TaskInfo *
Definition task_info.hxx:71
Definition task_handle.hxx:183
auto await_suspend(ice::coroutine_handle< Promise > coro) noexcept
Definition task_handle.hxx:185
Definition task_handle.hxx:205
constexpr void await_suspend(ice::coroutine_handle<>) const noexcept
Definition task_handle.hxx:210
void await_resume() const noexcept
Definition task_handle.hxx:212
ice::TaskInfo * _info
Definition task_handle.hxx:206
constexpr bool await_ready() const noexcept
Definition task_handle.hxx:208
Definition task_handle.hxx:143
TaskInfoPromise(Class const &, ice::TaskHandle &handle, Args const &...) noexcept
Definition task_handle.hxx:160
auto final_suspend() const noexcept
Definition task_handle.hxx:227
~TaskInfoPromise() noexcept
Definition task_handle.hxx:170
ice::TaskInfo * _info
Definition task_handle.hxx:144
TaskInfoPromise() noexcept=default
auto initial_suspend() const noexcept
Definition task_handle.hxx:222
Definition task_promise_base.hxx:15
ice::TaskHandle & _handle
Definition task_handle.hxx:240
TaskTokenBase(ice::TaskHandle &handle) noexcept
Definition task_handle.hxx:235
~TaskTokenBase() noexcept=default
ice::TaskInfoPromise< Result > promise_type
Definition task_handle.hxx:257
ice::TaskInfoPromise< Result > promise_type
Definition task_handle.hxx:250