NAME
A function of omni::application::shutdown_handler
omni::application::shutdown_handler::detach
A function of omni::application::shutdown_handler
#include <omni/application.hpp>void omni::application::shutdown_handler::detach(const omni::callback& shutdown_func)
DESCRIPTION
Detaches an
Calling this function after an
top
Detaches an
omni::callback that was first attached via the omni::application::shutdown_handler::attach function. If the callback was never first attached, this function has no effect.Calling this function after an
omni::application::run context has returned will have no effect since the run function will have already returned thus calling the delegates.
top
CONSIDERATIONS
This function will only have an effect if you have explicitly called one of the
top
This function will only have an effect if you have explicitly called one of the
omni::application::run functions to block the main thread until program completion.
top
NOTES
Calling this function after the
top
Calling this function after the
shutdown handler has been called will have no effect on the handler since it will have already been called.
top
EXAMPLE
Visit the examples page for more.
top
#include <omnilib> void app_exit() { std::cout << "Application exiting" << std::endl; } void app_shutdown() { std::cout << "Application shutting down" << std::endl; } void app_run() { std::cout << "Leaving, waiting for CTRL+C" << std::endl; } int main(int argc, const char* argv[]) { omni::application::exit_handler::attach(&app_exit); omni::application::shutdown_handler::attach(&app_shutdown); if (argc > 2) { omni::application::shutdown_handler::detach(&app_shutdown); } return omni::application::run(&app_run); }
top