omni::application::stop

SYNOPSIS

Exits the main application with a return value specified by omni::application::set_return_code.

top

DESCRIPTION

Invokes omni::application::exit passing in the value retrieved from omni::application::set_return_code as the exit_status for the exit function.

top

RETURN VALUES

No return value.

top

ERRORS

No errors specific to this context.

top

CONSIDERATIONS

No extra considerations.

top

PLATFORM SPECIFIC

Nothing platform specific to account for.

top

NOTES

No additional notes.

top

EXAMPLE
#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;
}
Visit the examples page for more.

top