| 1 | #include <stdlib.h> |
|---|---|
| 2 | #include <signal.h> |
| 3 | #include <stdio.h> |
| 4 | #include <unistd.h> |
| 5 | |
| 6 | void handler (int in) |
| 7 | { |
| 8 | puts (s: "in handler routine"); |
| 9 | while (1) |
| 10 | ; |
| 11 | } |
| 12 | |
| 13 | void |
| 14 | foo () |
| 15 | { |
| 16 | puts (s: "in foo ()"); |
| 17 | kill (pid: getpid(), SIGUSR1); |
| 18 | } |
| 19 | int main () |
| 20 | { |
| 21 | puts (s: "in main"); // Set breakpoint here |
| 22 | signal (SIGUSR1, handler: handler); |
| 23 | puts (s: "signal handler set up"); |
| 24 | foo(); |
| 25 | puts (s: "exiting"); |
| 26 | return 0; |
| 27 | } |
| 28 |
