Lely core libraries 2.3.4
|
A RAII object type that registers a callback function with a lely::util::StopToken object. More...
#include <stop.hpp>
Public Member Functions | |
template<class C > | |
StopCallback (const StopToken &token, C &&cb) | |
Copies the token stop token, saves the cb callback function and registers with with token. More... | |
template<class C > | |
StopCallback (StopToken &&token, C &&cb) | |
Moves the token stop token, saves the cb callback function and registers with with token. More... | |
~StopCallback () | |
If *this has a lely::util::StopToken with associated stop-state, deregisters the saved callback function from it. More... | |
Additional Inherited Members | |
![]() | |
void(* | func )(struct stop_func *func) |
The function to be invoked when a stop request is issued. | |
A RAII object type that registers a callback function with a lely::util::StopToken object.
The callback function will be invoked when the lely::util::StopSource object associated with the stop token is requested to stop.
|
inlineexplicit |
Copies the token stop token, saves the cb callback function and registers with with token.
If a stop request has already been issued for the associated lely::util::StopSource object, the callback function is invoked in the calling thread before the constructor returns.
|
inlineexplicit |
Moves the token stop token, saves the cb callback function and registers with with token.
If a stop request has already been issued for the associated lely::util::StopSource object, the callback function is invoked in the calling thread before the constructor returns.
|
inline |
If *this
has a lely::util::StopToken with associated stop-state, deregisters the saved callback function from it.
If the callback function is being invoked concurrently on another thread, the destructor does not return until the callback function invocation is complete. If the callback function is being invoked on the calling thread, the destructor does not wait until the invocation is complete. Hence it is safe to invoke the destructor from the callback function.