omni::application::startup_handler::detach
NAME

omni::application::startup_handler::detach

A function of omni::application::startup_handler

#include <omni/application.hpp>
void omni::application::startup_handler::detach(const omni::callback& start_func)

SYNOPSIS

Detaches an omni::callback delegate from the application startup handler.

top

DESCRIPTION

Detaches an omni::callback that was first attached via the omni::application::startup_handler::attach function. If the callback was never first attached, this function has no effect.

top

PARAMETERS

start_func - The omni::callback to detach from the startup event.

top


CONSIDERATIONS

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

Calling this function after the run context has entered the main application loop will have no effect on the startup handler since it will have already been called.

top


EXAMPLE

#include <omni/application>

void app_start()
{
    std::cout << "Application starting up" << std::endl;
}

void app_exit()
{
    std::cout << "Application exiting" << std::endl;
}

void app_shutdown()
{
    std::cout << "Application shutting down" << std::endl;
}

void app_run()
{
    std::cout << "Leaving, waiting for CTRL+C" << std::endl;
}

int main(int argc, const char* argv[])
{
    omni::application::startup_handler::attach(&app_start);
    omni::application::exit_handler::attach(&app_exit);
    omni::application::shutdown_handler::attach(&app_shutdown);
    if (argc > 2) {
        omni::application::startup_handler::detach(&app_start);
    }
    return omni::application::run(&app_run);
}
Visit the examples page for more.

top