Boost.Test > Components > The Execution Monitor > boost::execution_monitor
Boost Test logo

boost::execution_monitor

boost::execution_monitor uniformly detects and reports the occurrence of several types of signals and exceptions, reducing various errors to a uniform boost::execution_exception which is returned to a caller.

class execution_monitor {
public:
    virtual     ~execution_monitor();
    
    int         execute( bool catch_system_errors = true, int timeout = 0 );
    
    virtual int function() = 0;
    
}; // exception monitor

execution_monitor::~execution_monitor()

Supplied cause this class intended to be used polymorphically.

execution_monitor::execute( bool catch_system_errors, int timeout )

Effects:

Calls the execution_monitor::function() inside a try/catch block which may also include other unspecified platform dependent error detection code. Throws boost::execution_exception on an uncaught C++ exception, timeout alarm and, if catch_system_errors flag is true, a hardware or software signal, trap, or other exception. If catch_system_errors flag is false program will crash in case of system level error occur. execution_monitor::execute() doesn't consider it an error for the execution_monitor::function() to return a non-zero value.

Returns:

The integer value returned by the execution_monitor::function().

execution_monitor::function()

User supplied function to monitor.