Re: Question about Ctrl-C and less

Поиск
Список
Период
Сортировка
От Kevin Brown
Тема Re: Question about Ctrl-C and less
Дата
Msg-id 20051020224209.GD14950@filer
обсуждение исходный текст
Ответ на Re: Question about Ctrl-C and less  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: Question about Ctrl-C and less  (mark@mark.mielke.cc)
Список pgsql-hackers
Martijn van Oosterhout wrote:
> You can't do a pclose in a signal handler, it's not one of the
> "reeentrant safe" functions and could lead to deadlocks. The signal
> manpage documents the ones you can use. Just set a flag. Setting the
> descriptor to NULL is worse because then we have check before every
> output function. fprintf(NULL, ...) will segfault on most
> architechtures I wager. 

Yeah, I was thinking that you'd do the check for the flag and invoke a
cleanup handler after the write() to the output file descriptor.  It's
not clear that you'd need to do the check anyplace else.  It's been a
while since I've messed with this stuff, but if I recall correctly,
the write() will return immediately after receipt of a signal, and
will indicate how much was actually written.  So receipt of a SIGINT
should wind up being handled in a reasonably timely fashion.

Additionally the normal SIGINT signal handler (the one that gets
invoked when the pager is turned off) can be called from the cleanup
handler in order to maintain the proper semantics.


-- 
Kevin Brown                          kevin@sysexperts.com


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Seeing context switch storm with 10/13 snapshot of
Следующее
От: Robert Creager
Дата:
Сообщение: Re: Seeing context switch storm with 10/13 snapshot of