diff options
author | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-11-06 14:31:38 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-11-06 14:31:38 +0000 |
commit | 199100c871a030cc44240072644abe9aab66bc02 (patch) | |
tree | b88def55f8e42b978120f498a2e4197260d5db23 /ext/Thread/Thread.xs | |
parent | 554b3ecafd2a8f619792c82298bc621b9e48a923 (diff) | |
download | perl-199100c871a030cc44240072644abe9aab66bc02.tar.gz |
Per-thread magicals now stored in their own thr->magicals and keyed
more directly. cvcache and oursv become ordinary struct thread
fields instead of #defined thr->Tfoo ones. SvREFCNT_inc now checks
for 0 again. Main thread initialisation done by new function
init_main_thread instead of (now fixed) new_struct_thread.
p4raw-id: //depot/perl@205
Diffstat (limited to 'ext/Thread/Thread.xs')
-rw-r--r-- | ext/Thread/Thread.xs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs index 1ef3ebc6fc..9c0325e07d 100644 --- a/ext/Thread/Thread.xs +++ b/ext/Thread/Thread.xs @@ -115,6 +115,8 @@ void *arg; goto finishoff; } + CATCH_SET(TRUE); + /* Now duplicate most of perl_call_sv but with a few twists */ op = (OP*)&myop; Zero(op, 1, LOGOP); @@ -142,7 +144,7 @@ void *arg; /* removed for debug */ SvREFCNT_dec(curstack); #endif - SvREFCNT_dec(cvcache); + SvREFCNT_dec(thr->cvcache); SvREFCNT_dec(thr->magicals); SvREFCNT_dec(thr->specific); Safefree(markstack); @@ -151,6 +153,7 @@ void *arg; Safefree(retstack); Safefree(cxstack); Safefree(tmps_stack); + Safefree(ofs); MUTEX_LOCK(&thr->mutex); DEBUG_L(PerlIO_printf(PerlIO_stderr(), @@ -207,7 +210,6 @@ char *class; savethread = thr; thr = new_struct_thread(thr); - init_stacks(ARGS); SPAGAIN; DEBUG_L(PerlIO_printf(PerlIO_stderr(), "%p: newthread, tid is %u, preparing stack\n", @@ -236,7 +238,7 @@ char *class; #endif if (err) { /* Thread creation failed--clean up */ - SvREFCNT_dec(cvcache); + SvREFCNT_dec(thr->cvcache); remove_thread(thr); MUTEX_DESTROY(&thr->mutex); for (i = 0; i <= AvFILL(initargs); i++) @@ -251,7 +253,7 @@ char *class; croak("panic: sigprocmask"); #endif sv = newSViv(thr->tid); - sv_magic(sv, oursv, '~', 0, 0); + sv_magic(sv, thr->oursv, '~', 0, 0); SvMAGIC(sv)->mg_private = Thread_MAGIC_SIGNATURE; return sv_bless(newRV_noinc(sv), gv_stashpv(class, TRUE)); } @@ -352,7 +354,7 @@ self(class) SV *sv; PPCODE: sv = newSViv(thr->tid); - sv_magic(sv, oursv, '~', 0, 0); + sv_magic(sv, thr->oursv, '~', 0, 0); SvMAGIC(sv)->mg_private = Thread_MAGIC_SIGNATURE; PUSHs(sv_2mortal(sv_bless(newRV_noinc(sv), gv_stashpv(class, TRUE)))); @@ -479,7 +481,7 @@ list(class) do { SV *sv = (SV*)SvRV(*svp); sv_setiv(sv, t->tid); - SvMAGIC(sv)->mg_obj = SvREFCNT_inc(t->Toursv); + SvMAGIC(sv)->mg_obj = SvREFCNT_inc(t->oursv); SvMAGIC(sv)->mg_flags |= MGf_REFCOUNTED; SvMAGIC(sv)->mg_private = Thread_MAGIC_SIGNATURE; t = t->next; |