mirror of
https://github.com/Clortox/dashboard.git
synced 2026-03-18 07:27:58 +00:00
Add interrupt handler
This commit is contained in:
23
src/handler/handler.cpp
Normal file
23
src/handler/handler.cpp
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
18
src/handler/handler.hpp
Normal file
18
src/handler/handler.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Tyler Perkins
|
||||
// 8-23-21
|
||||
// Handlers definitions
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <csignal>
|
||||
#include <iostream>
|
||||
|
||||
namespace dashboard {
|
||||
namespace handlers {
|
||||
void setHandlers();
|
||||
|
||||
void intHandler(int);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user