NAME
A typedef of omni::application::signal_handler
omni::application::signal_handler::callback
A typedef of omni::application::signal_handler
#include <omni/application.hpp>typedef omni::delegate1<void, int> omni::application::signal_handler::callback
DESCRIPTION
The callback function handler can be used to bind directly to a signal handler function, or you can simply pass the address of a static function to the handler functions.
top
The callback function handler can be used to bind directly to a signal handler function, or you can simply pass the address of a static function to the handler functions.
top
ERRORS
If an exception occurs on an attached delegate, it will be handled according to
top
If an exception occurs on an attached delegate, it will be handled according to
omni::sync::user_thread_exception and omni::sync::unhandled_thread_exception.
top
EXAMPLE
Visit the examples page for more.
top
#include <omni/application> static volatile bool dorun = true; void app_signal(int sig) { std::cout << "Signal received: " << sig << std::endl; dorun = false; } void other_app_sig(int sig) { std::cout << "Other signal: " << sig << std::endl; dorun = false; } void app_run() { while (dorun) { omni::sync::sleep(10); // small sleep } } int main(int argc, char* argv[]) { omni::application::signal_handler::callback cb = &app_signal; if (argc > 3) { cb = &other_app_sig; } omni::application::signal_handler::attach(cb); return omni::application::run(&app_run); }
top