|
ecor
|
In-place stop callback, which is a callback that can be registered with an inplace_stop_token to be invoked when a stop is requested. More...
#include <ecor.hpp>
Public Member Functions | |
| inplace_stop_callback (inplace_stop_callback &&)=delete | |
| inplace_stop_callback (inplace_stop_callback const &)=delete | |
| template<typename Initializer > | |
| inplace_stop_callback (inplace_stop_token st, Initializer &&init) noexcept(std::is_nothrow_constructible_v< CallbackFn, Initializer > &&std::is_nothrow_invocable_v< CallbackFn >) | |
| inplace_stop_callback & | operator= (inplace_stop_callback &&)=delete |
| inplace_stop_callback & | operator= (inplace_stop_callback const &)=delete |
In-place stop callback, which is a callback that can be registered with an inplace_stop_token to be invoked when a stop is requested.
This allows for cooperative cancellation of asynchronous operations without the need for dynamic memory allocation.
This allows for cooperative cancellation of asynchronous operations without the need for dynamic memory allocation. The callback is constructed with a stop token and an initializer for the callback function. If the stop token is already in a stopped state when the callback is constructed, the callback function is invoked immediately.
The callback is automatically unlinked from the stop source when it is destroyed, ensuring that it will not be invoked after it has been destroyed. The callback function is stored in-place within the callback object, allowing for efficient storage without dynamic memory allocation.