A quick merge of latest mainline.
Gurusamy Sarathy [Thu, 16 Oct 1997 20:45:58 +0000 (20:45 +0000)]
p4raw-id: //depot/win32/perl@143

1  2 
global.sym
perl.c
perl.h
thread.h
win32/Makefile
win32/makefile.mk

diff --cc global.sym
Simple merge
diff --cc perl.c
--- 1/perl.c
--- 2/perl.c
+++ b/perl.c
@@@ -121,10 -121,13 +121,13 @@@ register PerlInterpreter *sv_interp
     /* Init the real globals (and main thread)? */
      if (!linestr) {
  #ifdef USE_THREADS
+       XPV *xpv;
        INIT_THREADS;
 -      New(53, thr, 1, struct thread);
 +      Newz(53, thr, 1, struct thread);
        MUTEX_INIT(&malloc_mutex);
        MUTEX_INIT(&sv_mutex);
+       /* Safe to use SVs from now on */
        MUTEX_INIT(&eval_mutex);
        COND_INIT(&eval_cond);
        MUTEX_INIT(&threads_mutex);
@@@ -267,13 -272,14 +287,19 @@@ register PerlInterpreter *sv_interp
            ThrSETSTATE(t, THRf_DEAD);
            MUTEX_UNLOCK(&t->mutex);
            nthreads--;
+           /*
+            * The SvREFCNT_dec below may take a long time (e.g. av
+            * may contain an object scalar whose destructor gets
+            * called) so we have to unlock threads_mutex and start
+            * all over again.
+            */
            MUTEX_UNLOCK(&threads_mutex);
 +#ifdef WIN32
 +          if ((WaitForSingleObject(t->Tself,INFINITE) == WAIT_FAILED)
 +              || (GetExitCodeThread(t->Tself,(LPDWORD)&av) == 0))
 +#else
            if (pthread_join(t->Tself, (void**)&av))
 +#endif
                croak("panic: pthread_join failed during global destruction");
            SvREFCNT_dec((SV*)av);
            DEBUG_L(PerlIO_printf(PerlIO_stderr(),
diff --cc perl.h
Simple merge
diff --cc thread.h
Simple merge
diff --cc win32/Makefile
Simple merge
Simple merge