Commit 9c60ea6e authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

hidde signals

parent dacb38a0
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
#include <functional> #include <functional>
#include <vector> #include <vector>
/** We protect almost every thing if SCALFMM_USE_SIGNALS is undef
* because is failled to compile with Clang.
*/
// Function in FSignalHandler.cpp // Function in FSignalHandler.cpp
bool f_install_signal_handler(); bool f_install_signal_handler();
...@@ -25,9 +29,11 @@ protected: ...@@ -25,9 +29,11 @@ protected:
/** A signal has been sent */ /** A signal has been sent */
void intercept(const int signalReceived){ void intercept(const int signalReceived){
#ifdef SCALFMM_USE_SIGNALS
for(unsigned idx = 0 ; idx < callbacks.size() ; ++idx){ for(unsigned idx = 0 ; idx < callbacks.size() ; ++idx){
callbacks[idx](signalReceived); callbacks[idx](signalReceived);
} }
#endif
} }
friend void f_sig_handler(int signalReceived); friend void f_sig_handler(int signalReceived);
...@@ -41,11 +47,14 @@ public: ...@@ -41,11 +47,14 @@ public:
/** Add a callback to the listeners list */ /** Add a callback to the listeners list */
void registerCallback(std::function<void(int)> aCallback){ void registerCallback(std::function<void(int)> aCallback){
#ifdef SCALFMM_USE_SIGNALS
callbacks.push_back(aCallback); callbacks.push_back(aCallback);
#endif
} }
/** Remove some listeners */ /** Remove some listeners */
void unregisterCallback(std::function<void(int)> aCallback){ void unregisterCallback(std::function<void(int)> aCallback){
#ifdef SCALFMM_USE_SIGNALS
using fptr = void(*)(int); using fptr = void(*)(int);
unsigned idx = 0 ; unsigned idx = 0 ;
...@@ -62,6 +71,7 @@ public: ...@@ -62,6 +71,7 @@ public:
} }
callbacks.resize(callbacks.size() - idxCopy); callbacks.resize(callbacks.size() - idxCopy);
#endif
} }
bool isInstalled(){ bool isInstalled(){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment