diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 1997-11-07 01:37:28 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 1997-11-07 01:37:28 +0000 |
commit | e77eedc24c0252a902559034f2aa207f216529cc (patch) | |
tree | d59ef6c28b87613607887003bd9d900644335b67 /ext/Thread | |
parent | 4e35701fd273ba8d0093a29660dee38a92408e9b (diff) | |
parent | 5756a3ac9bce8d31d81b13d0e57cdc87e2565fe4 (diff) | |
download | perl-e77eedc24c0252a902559034f2aa207f216529cc.tar.gz |
Raw integrate of latest perl
p4raw-id: //depot/ansiperl@208
Diffstat (limited to 'ext/Thread')
-rw-r--r-- | ext/Thread/Thread.xs | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs index 6e7f4b7638..d132394689 100644 --- a/ext/Thread/Thread.xs +++ b/ext/Thread/Thread.xs @@ -129,6 +129,8 @@ threadstart(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); @@ -156,13 +158,16 @@ threadstart(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); Safefree(scopestack); Safefree(savestack); Safefree(retstack); Safefree(cxstack); Safefree(tmps_stack); + Safefree(ofs); MUTEX_LOCK(&thr->mutex); DEBUG_L(PerlIO_printf(PerlIO_stderr(), @@ -218,20 +223,7 @@ newthread (SV *startsv, AV *initargs, char *Class) #endif savethread = thr; - sv = newSVpv("", 0); - SvGROW(sv, sizeof(struct thread) + 1); - SvCUR_set(sv, sizeof(struct thread)); - thr = (Thread) SvPVX(sv); - DEBUG_L(PerlIO_printf(PerlIO_stderr(), "%p: newthread(%s) = %p)\n", - savethread, SvPEEK(startsv), thr)); - oursv = sv; - /* If we don't zero these foostack pointers, init_stacks won't init them */ - markstack = 0; - scopestack = 0; - savestack = 0; - retstack = 0; - init_stacks(ARGS); - curcop = savethread->Tcurcop; /* XXX As good a guess as any? */ + thr = new_struct_thread(thr); SPAGAIN; defstash = savethread->Tdefstash; /* XXX maybe these should */ curstash = savethread->Tcurstash; /* always be set to main? */ @@ -277,7 +269,7 @@ newthread (SV *startsv, AV *initargs, 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++) @@ -292,7 +284,7 @@ newthread (SV *startsv, AV *initargs, 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)); #else @@ -405,7 +397,7 @@ self(Class) PPCODE: #ifdef USE_THREADS 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)))); #endif @@ -548,7 +540,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; |