Implementation of task::promise_t for void return type.
More...
#include <task.h>
|
| std::atomic< bool > | cancelled |
| | Whether the task is cancelled or not.
|
| |
|
| using | storage_type = result_t< T > |
| | Variant representing one of either 3 states of the result value : empty, result, exception.
|
| |
|
| std_coroutine::coroutine_handle | release_awaiter () |
| | Unlinks this promise from its currently linked awaiter and returns it.
|
| |
| void | throw_if_not_empty () |
| | Check if the result is empty, throws otherwise.
|
| |
|
| std_coroutine::coroutine_handle | awaiter = nullptr |
| | Coroutine handle currently awaiting the completion of this promise.
|
| |
| std::atomic< uint8_t > | state = sf_none |
| | State of the awaitable tied to this promise.
|
| |
| storage_type | value = std::monostate{} |
| | State of the result value.
|
| |
Implementation of task::promise_t for void return type.
◆ storage_type
Variant representing one of either 3 states of the result value : empty, result, exception.
◆ await_transform()
Function called whenever co_await is used inside of the task.
- Exceptions
-
- Returns
- proxy_awaiter Returns a proxy awaiter that will check for cancellation on resumption
◆ emplace_value()
template<bool Notify = true, typename... Args>
requires (std::constructible_from<T, Args...>)
Construct the result in place by forwarding the arguments, and by default resume any awaiter.
- Template Parameters
-
| Notify | Whether to resume any awaiter or not. |
- Exceptions
-
◆ final_suspend()
Function called by the standard library when the coroutine reaches its last suspension point.
- Returns
- final_awaiter Special object containing the chain resolution and clean-up logic.
◆ get_awaitable()
Get an awaitable object for this promise.
- Exceptions
-
- Returns
- awaitable<T> An object that can be co_await-ed to retrieve the value of this promise.
◆ get_return_object()
Function called by the standard library when the coroutine is created.
- Returns
- task The coroutine object
◆ initial_suspend()
Function called by the standard library when the coroutine is created.
- Returns
- std::suspend_never Don't suspend, the coroutine starts immediately.
◆ notify_awaiter()
Notify a currently awaiting coroutine that the result is ready.
- Note
- This may resume the coroutine on the current thread.
- Exceptions
-
| ? | Any exception thrown by the coroutine if resumed will propagate |
◆ release_awaiter()
Unlinks this promise from its currently linked awaiter and returns it.
At the time of writing this is only used in the case of a serious internal error in dpp::task. Avoid using this as this will crash if the promise is used after this.
◆ return_void()
Function called by the standard library when the coroutine co_returns.
Sets the promise state to finished.
◆ set_exception()
template<bool Notify = true>
Set this promise to an exception and resume any awaiter.
- Template Parameters
-
| Notify | Whether to resume any awaiter or not. |
- Exceptions
-
| dpp::logic_exception | if the promise is not empty. |
| ? | Any exception thrown by the coroutine if resumed will propagate |
◆ set_value() [1/2]
template<bool Notify = true>
requires (std::is_void_v<T>)
Construct a void result, and resume any awaiter.
- Template Parameters
-
| Notify | Whether to resume any awaiter or not. |
- Exceptions
-
◆ set_value() [2/2]
template<bool Notify = true,
typename U = T>
requires (std::convertible_to<
U&&, T>)
Construct the result by forwarding reference, and resume any awaiter.
- Template Parameters
-
| Notify | Whether to resume any awaiter or not. |
- Exceptions
-
◆ throw_if_not_empty()
Check if the result is empty, throws otherwise.
- Exceptions
-
◆ unhandled_exception()
Function called by the standard library when an exception is thrown and not caught in the coroutine.
Stores the exception pointer to rethrow on co_await. If the task object is destroyed and was not cancelled, throw instead
◆ final_awaiter< void >
◆ awaiter
Coroutine handle currently awaiting the completion of this promise.
◆ cancelled
Whether the task is cancelled or not.
◆ state
State of the awaitable tied to this promise.
◆ value