summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-25 09:18:09 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-25 09:18:09 +0000
commitfb31afc5a23b33bd30bc63d2269bc7eebba2fe2c (patch)
tree205a9634ee094d5f5ad191f69da8c6722249f618 /process.c
parent8f800a24525671fce407cefac9cff56a070f6a3b (diff)
* process.c (rb_syswait): thread kludge; should be fixed to
support native thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/process.c b/process.c
index e10c0d7096..da8986207a 100644
--- a/process.c
+++ b/process.c
@@ -588,29 +588,36 @@ void
rb_syswait(pid)
int pid;
{
+ static int overriding;
RETSIGTYPE (*hfunc)_((int)), (*qfunc)_((int)), (*ifunc)_((int));
int status;
- int i;
+ int i, hooked = Qfalse;
+ if (!overriding) {
#ifdef SIGHUP
- hfunc = signal(SIGHUP, SIG_IGN);
+ hfunc = signal(SIGHUP, SIG_IGN);
#endif
#ifdef SIGQUIT
- qfunc = signal(SIGQUIT, SIG_IGN);
+ qfunc = signal(SIGQUIT, SIG_IGN);
#endif
- ifunc = signal(SIGINT, SIG_IGN);
+ ifunc = signal(SIGINT, SIG_IGN);
+ overriding = Qtrue;
+ hooked = Qtrue;
+ }
do {
- i = rb_waitpid(pid, 0, &status);
+ i = rb_waitpid(pid, &status, 0);
} while (i == -1 && errno == EINTR);
+ if (hooked) {
#ifdef SIGHUP
- signal(SIGHUP, hfunc);
+ signal(SIGHUP, hfunc);
#endif
#ifdef SIGQUIT
- signal(SIGQUIT, qfunc);
+ signal(SIGQUIT, qfunc);
#endif
- signal(SIGINT, ifunc);
+ signal(SIGINT, ifunc);
+ }
}
static VALUE