Question: Our program calls two functions important task(and usual task) in an infinite loop. You are asked to complete the below program to implement the following

Our program calls two functions important task(and usual task) in an infinite loop. You are asked to complete the below program to implement the following two features (i) The program should NOT quit when user presses ctrl-c which generates SIGINT. Instead, it handles it using the the my_sig_handler function, which is implemented below (ii) The execution of important_task() should not be interrupted by any signal. So block all the signals before calling it. After calling it, you need to restore the previous old mask For a clear code, ignore error checking for now! // all the necessary libraries are included and // the following functions are already implemented, just use them important_task O/*do something important /* ) usual task () do something /* void my siq handler (int signo) I fprintf (stderr, "Ctrl-c is pressed, but I will not quit! " void main) struct sigaction act; sigset_t allsig, oldsig; while (1) important task ) usual_task)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
