… | |
… | |
769 | #endif |
769 | #endif |
770 | |
770 | |
771 | /* |
771 | /* |
772 | * This overrides the default magic get method of %SIG elements. |
772 | * This overrides the default magic get method of %SIG elements. |
773 | * The original one doesn't provide for reading back of PL_diehook/PL_warnhook |
773 | * The original one doesn't provide for reading back of PL_diehook/PL_warnhook |
774 | * and instead of tryign to save and restore the hash elements, we just provide |
774 | * and instead of trying to save and restore the hash elements, we just provide |
775 | * readback here. |
775 | * readback here. |
776 | * We only do this when the hook is != 0, as they are often set to 0 temporarily, |
|
|
777 | * not expecting this to actually change the hook. This is a potential problem |
|
|
778 | * when a schedule happens then, but we ignore this. |
|
|
779 | */ |
776 | */ |
780 | static int |
777 | static int |
781 | coro_sigelem_get (pTHX_ SV *sv, MAGIC *mg) |
778 | coro_sigelem_get (pTHX_ SV *sv, MAGIC *mg) |
782 | { |
779 | { |
783 | const char *s = MgPV_nolen_const (mg); |
780 | const char *s = MgPV_nolen_const (mg); |
… | |
… | |
836 | if (strEQ (s, "__WARN__")) svp = &PL_warnhook; |
833 | if (strEQ (s, "__WARN__")) svp = &PL_warnhook; |
837 | |
834 | |
838 | if (svp) |
835 | if (svp) |
839 | { |
836 | { |
840 | SV *old = *svp; |
837 | SV *old = *svp; |
841 | *svp = newSVsv (sv); |
838 | *svp = SvOK (sv) ? newSVsv (sv) : 0; |
842 | SvREFCNT_dec (old); |
839 | SvREFCNT_dec (old); |
843 | return 0; |
840 | return 0; |
844 | } |
841 | } |
845 | } |
842 | } |
846 | |
843 | |