NAME
A static function of omni::application
omni::application::stop
A static function of omni::application
#include <omni/application.hpp>void omni::application::stop()
SYNOPSIS
Exits the main application with a return value specified by
top
Exits the main application with a return value specified by
omni::application::set_return_code.
top
DESCRIPTION
Invokes
top
Invokes
omni::application::exit passing in the value retrieved from omni::application::set_return_code as the exit_status for the exit function.
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; std::cout << "Running" << std::endl; while (dorun) { omni::sync::sleep(10); // small sleep if (++count > 100) { std::cout << "Calling stop" << std::endl; omni::application::stop(); } } } int main(int argc, const char* argv[]) { omni::application::signal_handler::attach(&app_signal); int ret = omni::application::run(&app_run); std::cout << "Return code: " << ret << std::endl; return ret; }
top