diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 1997-11-08 15:03:39 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 1997-11-08 15:03:39 +0000 |
commit | 0b9678a8abcf790b88babcb35eec34072787a87f (patch) | |
tree | d50c10d5faf510d03b1fa735abc8709d93020f8b /ext | |
parent | 5ddb6eab5b331747cc6c97d7afbea3b5a48d2c4d (diff) | |
download | perl-0b9678a8abcf790b88babcb35eec34072787a87f.tar.gz |
Get threads working again on Win32
Root cause of fail was init_thread_intern() in
new_struct_thread() (which is called in parent thread)
clobbering dTHR of parent thread.
It is doubtfull if setting 'self' in new_struct_thread()
is 'right' but left in for now.
p4raw-id: //depot/ansiperl@213
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Thread/Thread.xs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs index 3a204b25b3..79e926cb31 100644 --- a/ext/Thread/Thread.xs +++ b/ext/Thread/Thread.xs @@ -89,8 +89,10 @@ threadstart(void *arg) AV *returnav; int i, ret; dJMPENV; + DEBUG_L(PerlIO_printf(PerlIO_stderr(), "new thread %p waiting to start\n", + thr)); - /* Don't call *anything* requiring dTHR until after pthread_setspecific */ + /* Don't call *anything* requiring dTHR until after SET_THR() */ /* * Wait until our creator releases us. If we didn't do this, then * it would be potentially possible for out thread to carry on and @@ -226,8 +228,8 @@ newthread (SV *startsv, AV *initargs, char *Class) thr = new_struct_thread(thr); SPAGAIN; DEBUG_L(PerlIO_printf(PerlIO_stderr(), - "%p: newthread, tid is %u, preparing stack\n", - savethread, thr->tid)); + "%p: newthread (%p), tid is %u, preparing stack\n", + savethread, thr, thr->tid)); /* The following pushes the arg list and startsv onto the *new* stack */ PUSHMARK(sp); /* Could easily speed up the following greatly */ @@ -235,7 +237,6 @@ newthread (SV *startsv, AV *initargs, char *Class) XPUSHs(SvREFCNT_inc(*av_fetch(initargs, i, FALSE))); XPUSHs(SvREFCNT_inc(startsv)); PUTBACK; - #ifdef THREAD_CREATE err = THREAD_CREATE(thr, threadstart); #else @@ -251,6 +252,8 @@ newthread (SV *startsv, AV *initargs, char *Class) MUTEX_UNLOCK(&thr->mutex); #endif if (err) { + DEBUG_L(PerlIO_printf(PerlIO_stderr(), + "%p: create of %p failed %d\n", savethread, thr, err)); /* Thread creation failed--clean up */ SvREFCNT_dec(thr->cvcache); remove_thread(thr); @@ -286,6 +289,7 @@ handle_thread_signal(int sig) } MODULE = Thread PACKAGE = Thread +PROTOTYPES: DISABLE void new(Class, startsv, ...) |