diff --git a/src/handler/handler.cpp b/src/handler/handler.cpp new file mode 100644 index 0000000..0d37ee2 --- /dev/null +++ b/src/handler/handler.cpp @@ -0,0 +1,23 @@ +/////////////////////////////////////////////////////////////////////////////// +// Tyler Perkins +// 8-23-21 +// Handlers implementation +// + +#include "handler.hpp" + +namespace dashboard { + namespace handlers { + void intHandler(int dummy){ + std::cerr << "Received, ctrl+c, quitting!\n"; + exit(0); + } + + void setHandlers(){ + //go through and set every handler + std::signal(SIGINT, intHandler); + } + } +} + + diff --git a/src/handler/handler.hpp b/src/handler/handler.hpp new file mode 100644 index 0000000..a5ab299 --- /dev/null +++ b/src/handler/handler.hpp @@ -0,0 +1,18 @@ +/////////////////////////////////////////////////////////////////////////////// +// Tyler Perkins +// 8-23-21 +// Handlers definitions +// + +#pragma once + +#include +#include + +namespace dashboard { + namespace handlers { + void setHandlers(); + + void intHandler(int); + } +} diff --git a/src/main.cpp b/src/main.cpp index 9d26cec..d71214d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,10 +5,11 @@ // #include "config.hpp" - +#include "handler/handler.hpp" int main(int argc, char** argv){ + dashboard::handlers::setHandlers(); return 0;