Update util and fix a few cppcheck warnings.
[m6w6/libmemcached] / util / signal.hpp
index e082d7d23613a39c141e6efd8cba463aada0dbda..fab67be63ce8f84c1cd7165ede04172987e71f49 100644 (file)
 #include <signal.h>
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (signal_callback_fn)();
+
+#ifdef __cplusplus
+}
+#endif
+
 namespace datadifferential {
 namespace util {
 
@@ -59,7 +69,6 @@ class SignalThread {
   uint64_t magic_memory;
   volatile shutdown_t __shutdown;
   pthread_mutex_t shutdown_mutex;
-  pthread_t thread;
 
 public:
 
@@ -84,6 +93,13 @@ public:
   void set_shutdown(shutdown_t arg);
   bool is_shutdown();
   shutdown_t get_shutdown();
+
+  void sighup();
+  void sighup(signal_callback_fn* arg);
+
+private:
+  pthread_t thread;
+  signal_callback_fn* _sighup;
 };
 
 } /* namespace util */