cpp/thread/stop callback

The class template provides an RAII object type that registers a callback function for an associated  object, such that the callback function will be invoked when the 's associated  is requested to stop.

Callback functions registered via 's constructor are invoked either in the same thread that successfully invokes for a  of the 's associated ; or if stop has already been requested prior to the constructor's registration, then the callback is invoked in the thread constructing the.

More than one can be created for the same, from the same or different threads concurrently. No guarantee is provided for the order in which they will be executed, but they will be invoked synchronously; except for (s) constructed after stop has already been requested for the, as described previously.

If an invocation of a callback exits via an exception then std is called.

is not, , , nor.

The template param type must be both  and. Any return value is ignored.