NAME
A static function of omni::application::exit_handler
omni::application::exit_handler::detach
A static function of omni::application::exit_handler
#include <omni/application.hpp>void omni::application::exit_handler::detach(const omni::callback& exit_func)
DESCRIPTION
Detaches a delegate function from the exit handler event. Detaching a delegate that has not been initially attached has no effect.
Since the exit handler will be invoked when the main function of the program is returning, a call to
top
Detaches a delegate function from the exit handler event. Detaching a delegate that has not been initially attached has no effect.
Since the exit handler will be invoked when the main function of the program is returning, a call to
detach can be made before or after the run context has been invoked and the handlers will be called accordingly.
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
EXAMPLE
Visit the examples page for more.
top
#include <omni/application> 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::exit_handler::detach(&app_exit); } return omni::application::run(&app_run); }
top