Files
cppdraft_translate/cppdraft/stopcallback/inplace.md
2025-10-25 03:02:53 +03:00

3.6 KiB
Raw Blame History

[stopcallback.inplace]

32 Concurrency support library [thread]

32.3 Stop tokens [thread.stoptoken]

32.3.10 Class template inplace_stop_callback [stopcallback.inplace]

32.3.10.1 General [stopcallback.inplace.general]

namespace std {templateclass inplace_stop_callback {public:using callback_type = CallbackFn; // [stopcallback.inplace.cons], constructors and destructortemplateexplicit inplace_stop_callback(inplace_stop_token st, Initializer&& init)noexcept(is_nothrow_constructible_v<CallbackFn, Initializer>); ~inplace_stop_callback();

inplace_stop_callback(inplace_stop_callback&&) = delete; inplace_stop_callback(const inplace_stop_callback&) = delete; inplace_stop_callback& operator=(inplace_stop_callback&&) = delete; inplace_stop_callback& operator=(const inplace_stop_callback&) = delete; private: CallbackFn callback-fn; // exposition only}; template inplace_stop_callback(inplace_stop_token, CallbackFn)-> inplace_stop_callback;}

1

#

Mandates: CallbackFn satisfies bothinvocable and destructible.

2

#

Remarks: For a type Initializer, ifstoppable-callback-for<CallbackFn, inplace_stop_token, Initializer> is satisfied, thenstoppable-callback-for<CallbackFn, inplace_stop_token, Initializer> is modeled.

For an inplace_stop_callback object, the exposition-only callback-fn member is its associated callback function ([stoptoken.concepts]).

32.3.10.2 Constructors and destructor [stopcallback.inplace.cons]

🔗

template<class Initializer> explicit inplace_stop_callback(inplace_stop_token st, Initializer&& init) noexcept(is_nothrow_constructible_v<CallbackFn, Initializer>);

1

#

Constraints: constructible_from<CallbackFn, Initializer> is satisfied.

2

#

Effects: Initializes callback-fn with std::forward(init) and executes a stoppable callback registration ([stoptoken.concepts]).

🔗

~inplace_stop_callback();

3

#

Effects: Executes a stoppable callback deregistration ([stoptoken.concepts]).