ecor
Loading...
Searching...
No Matches
ecor::inplace_stop_callback< CallbackFn > Struct Template Reference

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_callbackoperator= (inplace_stop_callback &&)=delete
 
inplace_stop_callbackoperator= (inplace_stop_callback const &)=delete
 

Detailed Description

template<typename CallbackFn>
struct ecor::inplace_stop_callback< CallbackFn >

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.


The documentation for this struct was generated from the following file: