Create a stop_callback that stores a callable constructed from arg and registers it with the stop state of token, if any.

Synopsis

Declared in <bslstl_stoptoken.h>

template<class t_ARG>
explicit
stop_callback(
    stop_token const& token,
    t_ARG&& arg,
    allocator_type const& alloc = allocator_type());

Description

If t_CALLBACK is allocator‐aware, the optionally specified alloc supplies memory; otherwise alloc is ignored. If token already refers to a stop‐requested state, invoke the callback before returning; otherwise register it with that stop state. Unlike std::stop_callback, these constructors are not currently noexcept. If token is an rvalue reference, it is unspecified whether this function moves from token.

Created with MrDocs