Change 29465 by [EMAIL PROTECTED] on 2006/12/05 09:41:44
Subject: [PATCH] Re: When should PERL_SYS_TERM() be called? [was: Re:
[PATCH] Re: [PATCH] Re: [PATCH] abstract mempool header testing]
From: Jarkko Hietaniemi <[EMAIL PROTECTED]>
Date: Mon, 04 Dec 2006 22:53:03 -0500
Message-ID: <[EMAIL PROTECTED]>
Re-instates #29424 (previously reverted by #29451), now fixed to work
with PERL_IMPLICIT_SYS, thanks to Jan Dubois. Also adds PERLIO_TERM to
the Symbian port.
Affected files ...
... //depot/perl/perlio.c#354 edit
... //depot/perl/symbian/symbianish.h#5 edit
... //depot/perl/win32/win32.c#267 edit
... //depot/perl/win32/wince.c#4 edit
Differences ...
==== //depot/perl/perlio.c#354 (text) ====
Index: perl/perlio.c
--- perl/perlio.c#353~29442~ 2006-12-03 11:16:17.000000000 -0800
+++ perl/perlio.c 2006-12-05 01:41:44.000000000 -0800
@@ -2412,19 +2412,19 @@
}
}
#endif
-#ifdef USE_ITHREADS
- MUTEX_LOCK(&PL_perlio_mutex);
-#endif
+#if !defined(WIN32) || !defined(PERL_IMPLICIT_SYS)
+ /* On Windows, under PERL_IMPLICIT_SYS, all memory allocated by
+ * PerlMemShared_...() will be freed anyways when PL_curinterp
+ * is being destroyed. */
if (PL_perlio_fd_refcnt_size /* Assuming initial size of zero. */
&& PL_perlio_fd_refcnt) {
- PerlMemShared_free(PL_perlio_fd_refcnt); /* Not Safefree() because was
allocated with PerlMemShared_realloc(). */
+ /* Not bothering with PL_perlio_mutex since by now all the
+ * interpreters are gone. */
+ PerlMemShared_free(PL_perlio_fd_refcnt);
PL_perlio_fd_refcnt = NULL;
PL_perlio_fd_refcnt_size = 0;
}
-#ifdef USE_ITHREADS
- MUTEX_UNLOCK(&PL_perlio_mutex);
#endif
-
}
==== //depot/perl/symbian/symbianish.h#5 (text) ====
Index: perl/symbian/symbianish.h
--- perl/symbian/symbianish.h#4~27764~ 2006-04-11 06:47:05.000000000 -0700
+++ perl/symbian/symbianish.h 2006-12-05 01:41:44.000000000 -0800
@@ -120,7 +120,7 @@
#define Mkdir(path,mode) mkdir((path),(mode))
#ifndef PERL_SYS_TERM
-#define PERL_SYS_TERM() HINTS_REFCNT_TERM; OP_REFCNT_TERM;
MALLOC_TERM; CloseSTDLIB();
+#define PERL_SYS_TERM() HINTS_REFCNT_TERM; OP_REFCNT_TERM;
PERLIO_TERM; MALLOC_TERM; CloseSTDLIB();
#endif
#define BIT_BUCKET "NUL:"
==== //depot/perl/win32/win32.c#267 (text) ====
Index: perl/win32/win32.c
--- perl/win32/win32.c#266~29451~ 2006-12-04 06:31:08.000000000 -0800
+++ perl/win32/win32.c 2006-12-05 01:41:44.000000000 -0800
@@ -4902,11 +4902,10 @@
void
Perl_win32_term(void)
{
+ dTHX;
HINTS_REFCNT_TERM;
OP_REFCNT_TERM;
- /* Can't call PERLIO_TERM here because that calls PerlMemShared_free()
- * but we're too late for that (at least when using PERL_IMPLICIT_SYS)
- * since we've already done perl_free(). */
+ PERLIO_TERM;
MALLOC_TERM;
}
==== //depot/perl/win32/wince.c#4 (text) ====
Index: perl/win32/wince.c
--- perl/win32/wince.c#3~29451~ 2006-12-04 06:31:08.000000000 -0800
+++ perl/win32/wince.c 2006-12-05 01:41:44.000000000 -0800
@@ -2660,11 +2660,10 @@
DllExport void
Perl_win32_term(void)
{
+ dTHX;
HINTS_REFCNT_TERM;
OP_REFCNT_TERM;
- /* Can't call PERLIO_TERM here because that calls PerlMemShared_free()
- * but we're too late for that (at least when using PERL_IMPLICIT_SYS)
- * since we've already done perl_free(). */
+ PERLIO_TERM;
MALLOC_TERM;
}
End of Patch.