DataStorm  0.1
Data Distribution Service
CtrlCHandler.h
Go to the documentation of this file.
1 // **********************************************************************
2 //
3 // Copyright (c) 2018-present ZeroC, Inc. All rights reserved.
4 //
5 // **********************************************************************
6 
7 #ifndef DATASTORM_CTRL_C_HANDLER_H
8 #define DATASTORM_CTRL_C_HANDLER_H
9 
10 #include <DataStorm/Config.h>
11 #include <functional>
12 
13 namespace DataStorm
14 {
15 
22 using CtrlCHandlerCallback = std::function<void(int sig)>;
23 
32 {
33 public:
34 
42  static void maskSignals() noexcept;
43 
53  explicit CtrlCHandler(CtrlCHandlerCallback cb = nullptr);
54 
61  ~CtrlCHandler();
62 
68  CtrlCHandlerCallback setCallback(CtrlCHandlerCallback cb) noexcept;
69 
74  CtrlCHandlerCallback getCallback() const noexcept;
75 };
76 }
77 
78 #endif
#define DATASTORM_API
Definition: Config.h:37
Provides a portable way to handle Ctrl-C and Ctrl-C like signals.
Definition: CtrlCHandler.h:31
std::function< void(int sig)> CtrlCHandlerCallback
Invoked when a signal occurs.
Definition: CtrlCHandler.h:22
Definition: CtrlCHandler.h:13