Program Listing for File SignalHandling.hpp

Return to documentation for file (include/networkit/auxiliary/SignalHandling.hpp)

#ifndef NETWORKIT_AUXILIARY_SIGNAL_HANDLING_HPP_
#define NETWORKIT_AUXILIARY_SIGNAL_HANDLING_HPP_

#include <cstdint>
#include <exception>

namespace Aux {

class SignalHandler {
public:
    SignalHandler();

    ~SignalHandler();

    void assureRunning();

    bool isRunning();
};

namespace SignalHandling {
class InterruptException : public std::exception {
public:
    InterruptException() : std::exception() {}
    const char *what() const noexcept override { return "Received CTRL+C/SIGINT"; }
};

void init(SignalHandler *caller);

void reset(SignalHandler *caller);
} // namespace SignalHandling

} // namespace Aux

#endif // NETWORKIT_AUXILIARY_SIGNAL_HANDLING_HPP_