HV *hv;
I32 i;
if (!PL_psig_ptr) {
- New(73, PL_psig_ptr, SIG_SIZE, SV*);
- New(73, PL_psig_name, SIG_SIZE, SV*);
- New(73, PL_psig_pend, SIG_SIZE, int);
+ Newz(73, PL_psig_ptr, SIG_SIZE, SV*);
+ Newz(73, PL_psig_name, SIG_SIZE, SV*);
+ Newz(73, PL_psig_pend, SIG_SIZE, int);
}
GvMULTI_on(gv);
hv = GvHVn(gv);
sv_setsv(*init, &PL_sv_undef);
PL_psig_ptr[i] = 0;
PL_psig_name[i] = 0;
+ PL_psig_pend[i] = 0;
}
}
break;
return 0;
}
+void
+Perl_raise_signal(pTHX_ int sig)
+{
+ /* Set a flag to say this signal is pending */
+ PL_psig_pend[sig]++;
+ /* And one to say _a_ signal is pending */
+ PL_sig_pending = 1;
+}
+
+Signal_t
+Perl_csighandler(int sig)
+{
+#ifdef PERL_OLD_SIGNALS
+ /* Call the perl level handler now with risk we may be in malloc() etc. */
+ (*PL_sighandlerp)(sig);
+#else
+ dTHX;
+ Perl_raise_signal(aTHX_ sig);
+#endif
+}
+
+void
+Perl_despatch_signals(pTHX)
+{
+ int sig;
+ PL_sig_pending = 0;
+ for (sig = 1; sig < SIG_SIZE; sig++) {
+ if (PL_psig_pend[sig]) {
+ PL_psig_pend[sig] = 0;
+ (*PL_sighandlerp)(sig);
+ }
+ }
+}
+
int
Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
{
}
if (SvTYPE(sv) == SVt_PVGV || SvROK(sv)) {
if (i)
- (void)rsignal(i, PL_sighandlerp);
+ (void)rsignal(i, &Perl_csighandler);
else
*svp = SvREFCNT_inc(sv);
return 0;
if (!strchr(s,':') && !strchr(s,'\''))
sv_insert(sv, 0, 0, "main::", 6);
if (i)
- (void)rsignal(i, PL_sighandlerp);
+ (void)rsignal(i, &Perl_csighandler);
else
*svp = SvREFCNT_inc(sv);
}
return 0;
}
-void
-Perl_despatch_signals(pTHX)
-{
-#ifndef PERL_OLD_SIGNALS
- /* This is just a dummy for now */
-#endif
- PL_sig_pending = 0;
-}
-
static SV* sig_sv;
Signal_t
#else
/* Not clear if this will work */
(void)rsignal(sig, SIG_IGN);
- (void)rsignal(sig, PL_sighandlerp);
+ (void)rsignal(sig, &Perl_csighandler);
#endif
Perl_die(aTHX_ Nullch);
}
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
#ifdef SA_RESTART
+#if !defined(USE_PERLIO) || defined(PERL_OLD_SIGNALS)
act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
#endif
+#endif
#ifdef SA_NOCLDWAIT
if (signo == SIGCHLD && handler == (Sighandler_t)SIG_IGN)
act.sa_flags |= SA_NOCLDWAIT;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
#ifdef SA_RESTART
+#if !defined(USE_PERLIO) || defined(PERL_OLD_SIGNALS)
act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
#endif
+#endif
#ifdef SA_NOCLDWAIT
if (signo == SIGCHLD && handler == (Sighandler_t)SIG_IGN)
act.sa_flags |= SA_NOCLDWAIT;