sewardj | 9a2224b | 2002-06-19 10:17:40 +0000 | [diff] [blame^] | 1 | |
| 2 | #include <stdio.h> |
| 3 | #include <unistd.h> |
| 4 | #include <pthread.h> |
| 5 | #include <signal.h> |
| 6 | #include <errno.h> |
| 7 | |
| 8 | void hdlr ( int sig ) |
| 9 | { |
| 10 | printf("signal %d arrived\n", sig); |
| 11 | } |
| 12 | |
| 13 | int main ( void ) |
| 14 | { |
| 15 | int res; |
| 16 | /* Force use of libpthread here */ |
| 17 | pthread_testcancel(); |
| 18 | |
| 19 | printf("installing handler\n"); |
| 20 | signal(SIGINT, hdlr); |
| 21 | printf("installing handler done; please do Control-C\n"); |
| 22 | |
| 23 | res = pause(); |
| 24 | printf("pause done; res = %d, errno = %d\n", res, errno); |
| 25 | |
| 26 | printf("bye\n"); |
| 27 | |
| 28 | return 0; |
| 29 | } |