-
Notifications
You must be signed in to change notification settings - Fork 0
Initialize the framework
Gautier Lefebvre edited this page Feb 13, 2018
·
4 revisions
Create the framework and call the run
method.
After calling the run
method, the framework will wait for any thread to call the end
method.
After the end
method is called, run
returns and you can start the cleanup.
This example shows how to end the framework on a ctrl+c (SIGINT). You can see how Signal
works here.
int main(void) {
fwk::System* framework = new fwk::System();
// set a callback to the SIGINT signal.
fwk::Signal::get().setCallback(
fwk::Signal::Type::INT, // SIGINT,
[&] (void) -> bool {
framework->end();
return false; // set default SIGINT callback
});
// run the framework.
framework->run();
// after framework->end() is called.
// this cleans up any resource used by the framework.
delete framework;
}
Note that this example does not actually do anything since no modules has been initialized nor used.