Re: SIGPIPE handling
От | Bruce Momjian |
---|---|
Тема | Re: SIGPIPE handling |
Дата | |
Msg-id | 200401081653.i08Grrq21700@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: SIGPIPE handling (Manfred Spraul <manfred@colorfullife.com>) |
Список | pgsql-patches |
Manfred Spraul wrote: > Bruce Momjian wrote: > > >> > >>+ /* > >>+ * We could lose a signal during this test. > >>+ * In a multi-threaded application, this might > >>+ * be a problem. Do any non-threaded platforms > >> > Threaded or non-threaded? > > >>+ * lack sigaction()? > >>+ */ > >> > Additionally, the problem is not restricted to multithreaded apps: > signal(,SIG_IGN) clears all pending signals. OK, new function using sigblock(): pqsigfunc pqsignalinquire(int signo) { #if !defined(HAVE_POSIX_SIGNALS) pqsigfunc old_sigfunc; int old_sigmask; /* Prevent signal handler calls during test */ old_sigmask = sigblock(sigmask(signo)); old_sigfunc = signal(signo, SIG_DFL); signal(signo, old_sigfunc); sigblock(old_sigmask); return old_sigfunc; #else struct sigaction oact; if (sigaction(signo, NULL, &oact) < 0) return SIG_ERR; return oact.sa_handler; #endif /* !HAVE_POSIX_SIGNALS */ } -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
В списке pgsql-patches по дате отправления: