Quote:
Originally Posted by
jut26
I am looking for some examples of c programs which use a signal to notify the program to begin a certain action instead of having it continually loop to check to see if condition is attained
I suggest a program based around select and have a pipe pair dedicated to supporting signals. The write end is written by the signal handle (write a single byte containing the number of the signal) and have the select include the read end of the pipe in the read fd_set.
Then when a signal occurs a single byte is written to the pipe, this wakes up the select, the code in the select loop then reads the pipe and knows which signal occurred and can then handle it in a more graceful manner.