In C or C++ You need to build a signal handler which catches a signal to abnormally abort a process. In your answer below, provide the signal handler filled in correctly. Followed by the one line statement in main() to register the signal handler void mySignalHandler( //does anything need to go here?) { std::cout << "The interrupt signal is // provide a statement below to print out the signal # this handler is handling // terminate the program } int main (void) { ; // use signal() to register to catch a signal then calls mySignalHandler() to abort the process, provide with the sig handler below while(true){ cout << "Going to wait..." << endl; this_thread::sleep_for(1s); } return 1; }
In C or C++
You need to build a signal handler which catches a signal to abnormally abort a process.
In your answer below, provide the signal handler filled in correctly. Followed by the one line statement in main() to register the signal handler
void mySignalHandler( //does anything need to go here?) {
std::cout << "The interrupt signal is // provide a statement below to print out the signal # this handler is handling
// terminate the program
}
int main (void) {
; // use signal() to register to catch a signal then calls mySignalHandler() to abort the process, provide with the sig handler below
while(true){
cout << "Going to wait..." << endl;
this_thread::sleep_for(1s);
}
return 1;
}
Step by step
Solved in 3 steps with 1 images