Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
tAquireSignalProcessor
#include <stdio.h> #include <stdlib.h> #include <signal.h> #include <file> class tAquireSignalProcessor { public: tAquireSignalProcessor(const int signalID) { signal(signalID, sigHandler); } bool doProcess() { if(m_receivedSignal) { //reset m_receivedSignal = false; return true; } process(); return false; } private: static void sigHandler(int signum) { printf("Received signal %d\n", signum); m_receivedSignal = true; }; void process() { }; static bool m_receivedSignal; }; bool tAquireSignalProcessor::m_receivedSignal = false; int main() { tAquireSignalProcessor mysigprocessor(SIGUSR1); while(mysigprocessor.doProcess() == false) { } return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Hello World C++ - minimal
asa
abraham
OTHER - Two robots
Palindromo
project
Making pyramid using nested loop 2/2
RegExpress
Pollard Rho Brent Integer Factorization - 11476 - Factorizing Larget Integers
Sangharsh.vhawale
Please log in to post a comment.