Mercurial > hg > freeDiameter
comparison freeDiameterd/main.c @ 683:d59effdf5256
Improve management of the signals in freeDiameterd
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Tue, 18 Jan 2011 15:13:14 +0900 |
parents | 2e94ef0515d7 |
children | 4a9f08d6b6ba |
comparison
equal
deleted
inserted
replaced
682:1250381f7b7b | 683:d59effdf5256 |
---|---|
59 int main(int argc, char * argv[]) | 59 int main(int argc, char * argv[]) |
60 { | 60 { |
61 int ret; | 61 int ret; |
62 sigset_t sig_all; | 62 sigset_t sig_all; |
63 | 63 |
64 /* Block all signals from the current thread and all its future children */ | 64 /* Block all signals from the current thread and all its future children -- we will catch everything in catch_signals */ |
65 sigfillset(&sig_all); | 65 sigfillset(&sig_all); |
66 ret = pthread_sigmask(SIG_BLOCK, &sig_all, NULL); | 66 ret = pthread_sigmask(SIG_BLOCK, &sig_all, NULL); |
67 ASSERT(ret == 0); | 67 ASSERT(ret == 0); |
68 | 68 |
69 /* Parse the command-line */ | 69 /* Parse the command-line */ |
267 | 267 |
268 /* Signals that send an event */ | 268 /* Signals that send an event */ |
269 sigaddset(&ss, SIGUSR1); | 269 sigaddset(&ss, SIGUSR1); |
270 sigaddset(&ss, SIGUSR2); | 270 sigaddset(&ss, SIGUSR2); |
271 | 271 |
272 /* We unblock all other signals, so that their default handler is used (such as SIGTSTP) */ | |
273 CHECK_SYS_DO( pthread_sigmask( SIG_SETMASK, &ss, NULL ), goto out ); | |
274 | |
272 /* Now loop on the reception of the signal */ | 275 /* Now loop on the reception of the signal */ |
273 while (1) { | 276 while (1) { |
274 int sig, *ps; | 277 int sig, *ps; |
275 | 278 |
276 /* Wait to receive the next signal */ | 279 /* Wait to receive the next signal */ |