Question: so this is my current code how do i implement this to the code : Before calling sigaction ( ) , you should first use
so this is my current code how do i implement this to the code : Before calling sigaction you should first use sigemptyset to empty the signal set. Use $ man
sigemptyset' to find out the details. Modify your testsignal.cpp program above by using sigaction to
intercept SIGINT; replace the "for" loop with "while ; you should be able to quit the program by
entering Need to intercept SIGQUIT. here is my code : testalarm.cpp
#include
#include
#include
using namespace std;
simulates an alarm clock
void alarmoffint sig
cout "Alarm has gone off endl;
tell child process to wait for seconds before sending
a SIGALRM signal to its parent.
int main
int pid;
cout "Alarm testing!" endl;
if pid forkchild
sleep ;
Get parent process id send SIGALARM signal to it
kill getppid SIGALRM;
return ;
parent process arranges to catch SIGALRM with a call
to signal and then waits for the inevitable.
cout "Waiting for alarm to go off!" endl;
void signal SIGALRM alarmoff;
pause; process suspended, waiting for signals to wake up
cout "Done!" endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
