Call on release allows the user to pass a function to be called at destruction of this instance.
More...
template<class UnaryFunction>
class jau::call_on_release< UnaryFunction >
Call on release allows the user to pass a function to be called at destruction of this instance.
One goal was to provide a thread exit cleanup facility, setting a 'is_running' flag to false when the thread exists normally or abnormally.
jau::relaxed_atomic_bool is_running = true;
void some_thread_func() {
thread_local jau::call_on_release lili([&]() {
is_running = false;
});
...
do some work here, which might get cancelled
..
}
- Template Parameters
-
UnaryFunction | user provided function to be called @ dtor |
Definition at line 58 of file basic_algos.hpp.