$darkmode
main_run.hpp File Reference
#include <csignal>
#include <cstdlib>
#include <iostream>
#include <boost/lexical_cast.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <cloe/core.hpp>
#include <fable/utility.hpp>
#include "main_stack.hpp"
#include "simulation.hpp"
#include "stack.hpp"
Include dependency graph for main_run.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  engine::RunOptions
 

Functions

void engine::handle_signal (int)
 
template<typename Func >
auto engine::handle_cloe_error (std::ostream &out, Func f) -> decltype(f())
 
int engine::run (const RunOptions &opt, const std::vector< std::string > &filepaths)
 

Variables

Simulation * engine::GLOBAL_SIMULATION_INSTANCE {nullptr}
 

Detailed Description

See also
main.cpp

This file contains the "run" options and command.

Function Documentation

◆ handle_signal()

void engine::handle_signal ( int  sig)
inline

Handle interrupt signals sent by the operating system.

When this function is called, it cannot call any other functions that might have set any locks, because it might not get the lock, and then the program hangs instead of gracefully exiting. It's a bit sad, true, but that's the way it is.

That is why you cannot make use of the logging in this function. You also cannot make use of triggers, because they also have a lock.

The function immediately resets the signal handler to the default provided by the standard library, so that in the case that we do hang for some reasons, the user can force abort by sending the signal a third time.

Here is the call graph for this function:
Here is the caller graph for this function: