[#bsl-stop_callback-06-2constructor-04] = xref:bsl.adoc[bsl]::xref:bsl/stop_callback-06.adoc[stop_callback]::stop_callback :relfileprefix: ../../ :mrdocs: Create a `stop_callback` registering a callable built from `arg`. == Synopsis Declared in `<bslstl_stoptoken.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_ARG> explicit stop_callback( xref:bsl/stop_token.adoc[stop_token] const& token, t_ARG&& arg, xref:bsl/stop_callback-06/allocator_type.adoc[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`. == Parameters [cols="1,4"] |=== | Name| Description | *token* | stop token whose stop state the callback may register with | *arg* | argument forwarded to construct the stored callable | *alloc* | allocator used when `t_CALLBACK` is allocator‐aware |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#