NAME
A static function of omni::application::signal_handler
omni::application::signal_handler::ignore
A static function of omni::application::signal_handler
#include <omni/application.hpp>void omni::application::signal_handler::ignore(bool doignore)
DESCRIPTION
If
top
If
ignore is called with value of true then all signals sent to the application will be ignored until the function is called again with a value of false passed in. If a signal is sent while ignore is true, the last signal sent will still be set but no handlers will be invoked.
top
PARAMETERS
top
doignore - If true, application will ignore subsequent signals sent. A value of false will resume normal capture operations.
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
Since the signals can be raised on different threads, it's important to take care of any multi-threaded issues that might arise when using any of the signal handlers.
top
Since the signals can be raised on different threads, it's important to take care of any multi-threaded issues that might arise when using any of the signal handlers.
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 app_run() { int count = 0; bool atch = true; while (dorun) { omni::sync::sleep(10); // small sleep if (atch) { if (++count == 300) { omni::application::signal_handler::ignore(false); std::cout << "Will listen for the signal on app_signal" << std::endl; atch = false; } } } } int main(int argc, char* argv[]) { omni::application::signal_handler::attach(&app_signal); omni::application::signal_handler::ignore(true); std::cout << "Signal handler attached, but will ignore signals for ~3s" << std::endl; return omni::application::run(&app_run); }
top