develooper Front page | perl.perl5.porters | Postings from November 2004

Re: [perl #31851] Threading crash with closures

Thread Next
From:
Andrew Savige
Date:
November 23, 2004 02:08
Subject:
Re: [perl #31851] Threading crash with closures
Message ID:
20041123044727.41960.qmail@web50808.mail.yahoo.com
Further to John Myers' closure threading crash, I think I've
stumbled across the same problem, as further discussed here:

<http://www.perlmonks.org/?node_id=409473>

I'm pleased to report that Dave Mitchell's patch (Change 23433 by
davem on 2004/10/29 21:04:17) does indeed solve my crashing problem
(on both Linux and Windows). Notice that my crashes seem to occur
on multi-cpu machines _only_.

To shoehorn Dave's patch into Windows, I crudely hacked globals.c
and perlvars.h (in perl 5.8.5) as follows:

--- globals-orig.c      Thu Apr 17 06:43:29 2003
+++ globals.c   Tue Nov 23 15:58:26 2004
@@ -16,6 +16,10 @@
 #define PERL_IN_GLOBALS_C
 #include "perl.h"

+#if defined(USE_ITHREADS) && defined(WIN32)
+__declspec(dllexport) perl_mutex PL_op_mutex;
+#endif
+
 int
 Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...)
 {
--- perlvars-orig.h     Tue Aug 12 23:13:58 2003
+++ perlvars.h  Tue Nov 23 16:03:09 2004
@@ -44,7 +44,7 @@
 PERLVAR(Gmalloc_mutex, perl_mutex)     /* Mutex for malloc */
 #endif

-#if defined(USE_ITHREADS)
+#if defined(USE_ITHREADS) && !(defined(WIN32) && defined(PERL_IN_GLOBALS_C))
 PERLVAR(Gop_mutex,     perl_mutex)     /* Mutex for op refcounting */
 #endif

Note that this is not a clean fix.
I understand that Steve Hay is currently working on a clean fix
for this bug (in "Smoke [5.9.2] 23450" thread).

/-\


Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About