paul | 9a76e2d | 2004-01-19 21:25:17 +0000 | [diff] [blame] | 1 | |
| 2 | #include <zebra.h> |
| 3 | #include <sigevent.h> |
| 4 | |
| 5 | void |
| 6 | sighup (void) |
| 7 | { |
| 8 | printf ("processed hup\n"); |
| 9 | } |
| 10 | |
| 11 | void |
| 12 | sigusr1 (void) |
| 13 | { |
| 14 | printf ("processed usr1\n"); |
| 15 | } |
| 16 | |
| 17 | void |
| 18 | sigusr2 (void) |
| 19 | { |
| 20 | printf ("processed usr2\n"); |
| 21 | } |
| 22 | |
| 23 | struct quagga_signal_t sigs[] = |
| 24 | { |
| 25 | { |
| 26 | .signal = SIGHUP, |
| 27 | .handler = &sighup, |
| 28 | }, |
| 29 | { |
| 30 | .signal = SIGUSR1, |
| 31 | .handler = &sigusr1, |
| 32 | }, |
| 33 | { |
| 34 | .signal = SIGUSR2, |
| 35 | .handler = &sigusr2, |
| 36 | } |
| 37 | }; |
| 38 | |
| 39 | struct thread_master *master; |
| 40 | struct thread t; |
| 41 | |
| 42 | int |
| 43 | main (void) |
| 44 | { |
| 45 | master = thread_master_create (); |
| 46 | signal_init (master, Q_SIGC(sigs), sigs); |
| 47 | |
| 48 | while (thread_fetch (master, &t)) |
| 49 | thread_call (&t); |
| 50 | |
| 51 | exit (0); |
| 52 | } |