omni::application::exit

SYNOPSIS

Exits the main application with a return value of 0.

top

DESCRIPTION

Invokes omni::application::exit passing a 0 value for the exit status.

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 exit" << std::endl;
            omni::application::exit();
        }
    }
}

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