app/main.c libgimp/gimpsignal.c [Documentation only] Patches arising from

2000-04-30 Garry R. Osgood <gosgood@idt.net>
* app/main.c
* libgimp/gimpsignal.c [Documentation only]
Patches arising from Tim Mooney to fix #2742
which should (hopefully) die at this point.
removes on_sig_chld() from app/main() which
offers no meaningful functionality in light
of SA_NOCHLDSTOP.
This commit is contained in:
Garry R. Osgood 2000-04-30 17:47:32 +00:00 committed by Garry R. Osgood
parent c1d23aa596
commit ab4e420026
4 changed files with 45 additions and 23 deletions

View File

@ -1,3 +1,22 @@
2000-04-30 Garry R. Osgood <gosgood@idt.net>
* app/main.c
* libgimp/gimpsignal.c [Documentation only]
Based on a patch and testing furnished by Tim Mooney
<mooney@dogbert.cc.ndsu.nodak.edu> Retiring app/main.c
on_sig_chld(); at best this function is schizoid: On the left hand it
employs a facility for processes that have nothing better to do
than sleep until children die. (waitpid()) But it employs this
policy on the right hand, in a SIGCLD handler, a facility for
processes that have better things to do than sleep until children
die (!). And - at worse - it appeared to be contributing to the
ongoing #2742 saga. Mr. Mooney and I concur that for now asking
POSIX OS's not to generate SIGCLD at all is better than asking
mentally divided functions to handle them. Eventually we will need
SIGCLD handlers to implement runtime plug-in management (Mitch:
"gimp_nanny()") When we come to that fork in the road (;)), we
will need to work carefully so as not to re-introduce #2742.
2000-04-30 Sven Neumann <sven@gimp.org>
* app/gimage_cmds.c: reverted Asbjorns change (changing this file

View File

@ -55,7 +55,6 @@
#include <windows.h>
#else
static void on_signal (gint);
static void on_sig_child (gint);
#endif
static void init (void);
@ -345,10 +344,16 @@ main (int argc,
gimp_signal_syscallrestart (SIGTERM, on_signal);
gimp_signal_syscallrestart (SIGFPE, on_signal);
/* Handle child exits */
#ifndef __EMX__ /* OS/2 may not support SA_NOCLDSTOP -GRO */
gimp_signal_syscallrestart (SIGCHLD, on_sig_child);
/* Disable child exit notification. This doesn't just block */
/* receipt of SIGCHLD, it in fact completely disables the */
/* generation of the signal by the OS. This behavior is */
/* mandated by POSIX.1. */
gimp_signal_private (SIGCHLD, NULL, SA_NOCLDSTOP);
#endif
#endif
g_log_set_handler (NULL, G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL,
@ -464,20 +469,4 @@ on_signal (gint sig_num)
}
}
/* gimp core signal handler for death-of-child signals */
static void
on_sig_child (gint sig_num)
{
gint pid;
gint status;
while (1)
{
pid = waitpid (WAIT_ANY, &status, WNOHANG);
if (pid <= 0)
break;
}
}
#endif /* !G_OS_WIN32 */

View File

@ -53,9 +53,16 @@ gimp_signal_private (gint signum, void (*gimp_sighandler)(int), gint sa_flags)
struct sigaction sa;
struct sigaction osa;
/* this field is a union of sa_sighandler.sa_sighandler1 and */
/* sa_sigaction1 - don't set both at once... */
/* The sa_handler (mandated by POSIX.1) and sa_sigaction (a */
/* common extension) are often implemented by the OS as members */
/* of a union. This means you CAN NOT set both, you set one or */
/* the other. Caveat programmer! */
/* Passing gimp_signal_private a gimp_sighandler of NULL is not */
/* an error, and generally results in the action for that signal */
/* being set to SIG_DFL (default behavior). Many OSes define */
/* SIG_DFL as (void (*)()0, so setting sa_handler to NULL is */
/* the same thing as passing SIG_DFL to it. */
sa.sa_handler = gimp_sighandler;
/* Mask all signals while handler runs to avoid re-entrancy

View File

@ -53,9 +53,16 @@ gimp_signal_private (gint signum, void (*gimp_sighandler)(int), gint sa_flags)
struct sigaction sa;
struct sigaction osa;
/* this field is a union of sa_sighandler.sa_sighandler1 and */
/* sa_sigaction1 - don't set both at once... */
/* The sa_handler (mandated by POSIX.1) and sa_sigaction (a */
/* common extension) are often implemented by the OS as members */
/* of a union. This means you CAN NOT set both, you set one or */
/* the other. Caveat programmer! */
/* Passing gimp_signal_private a gimp_sighandler of NULL is not */
/* an error, and generally results in the action for that signal */
/* being set to SIG_DFL (default behavior). Many OSes define */
/* SIG_DFL as (void (*)()0, so setting sa_handler to NULL is */
/* the same thing as passing SIG_DFL to it. */
sa.sa_handler = gimp_sighandler;
/* Mask all signals while handler runs to avoid re-entrancy