Aero T.

asked • 07/23/21

This exercise shows the idea of how to use one user-defined signal handler to handle two signals.

This exercise shows the idea of how to use one user-defined signal handler to handle two signals. The two signals chosen for this exercise are SIGINT and SIGQUIT. Read (or Google) the descriptions of these two signals on page 319 and page 320 in the textbook. Note this idea applies to other signals as well. What you need to do is to write your own one signal handler function and install this handler for both SIGINT and SIGQUIT. When your signal handler is invoked, print out the signal no. (which is the argument to your 2 user-defined signal handler function) so that we know which signal has been caught.

Patrick B.

I'm interested, but only have cygwin unix emulator and Dev C++, and a shabby one at best, which do not support this type of IPC. The best I can offer is IPC via sockets using Java.
Report

07/23/21

Mulugeta E.

This is pretty basic Void sighandler(int signum) { Printf("signum is %d", signum); } Then in your main function add Signal(SIGINT, sighandler); Signal(SIGQUIT, sighandler); Make sure your main function doesn't exit right away so you have time to send the signals Ex: while(1){}
Report

08/01/21

1 Expert Answer

By:

Shanek K. answered • 08/13/21

Tutor
4.7 (74)

Computer Science Professional Tutor

Shanek K.

Let me know if you need more clarifications
Report

08/13/21

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.