diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-18 01:17:28 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-18 01:17:28 +0000 |
commit | dc92893f11da1644967e0cba1816c77151a07426 (patch) | |
tree | 26101da8a817307673c2bb51cb296aec2270de06 | |
parent | 13c658c95a9106efbd9a2a741a39e24c1c0f4e3b (diff) | |
download | perl-dc92893f11da1644967e0cba1816c77151a07426.tar.gz |
fix $/ init for multiple interpreters/threads
p4raw-id: //depot/perl@1523
-rw-r--r-- | ext/Thread/Thread.xs | 2 | ||||
-rw-r--r-- | perl.c | 11 | ||||
-rw-r--r-- | util.c | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs index be1e7af560..5d47cd0251 100644 --- a/ext/Thread/Thread.xs +++ b/ext/Thread/Thread.xs @@ -158,6 +158,8 @@ threadstart(void *arg) Safefree(tmps_stack); Safefree(ofs); + SvREFCNT_dec(rs); + SvREFCNT_dec(nrs); SvREFCNT_dec(statname); Safefree(screamfirst); Safefree(screamnext); @@ -164,9 +164,6 @@ perl_construct(register PerlInterpreter *sv_interp) SvREFCNT(&sv_yes) = (~(U32)0)/2; } - nrs = newSVpv("\n", 1); - rs = SvREFCNT_inc(nrs); - #ifdef PERL_OBJECT /* TODO: */ /* sighandlerp = sighandler; */ @@ -186,6 +183,9 @@ perl_construct(register PerlInterpreter *sv_interp) #endif } + nrs = newSVpv("\n", 1); + rs = SvREFCNT_inc(nrs); + init_stacks(ARGS); #ifdef MULTIPLICITY init_interp(); @@ -428,7 +428,10 @@ perl_destruct(register PerlInterpreter *sv_interp) Safefree(ors); /* $\ */ ors = Nullch; - SvREFCNT_dec(nrs); /* $\ helper */ + SvREFCNT_dec(rs); /* $/ */ + rs = Nullsv; + + SvREFCNT_dec(nrs); /* $/ helper */ nrs = Nullsv; multiline = 0; /* $* */ @@ -2783,7 +2783,7 @@ new_struct_thread(struct perl_thread *t) tainted = t->Ttainted; curpm = t->Tcurpm; /* XXX No PMOP ref count */ nrs = newSVsv(t->Tnrs); - rs = newSVsv(t->Trs); + rs = SvREFCNT_inc(nrs); last_in_gv = (GV*)SvREFCNT_inc(t->Tlast_in_gv); ofslen = t->Tofslen; ofs = savepvn(t->Tofs, ofslen); |