From: Nick Ing-Simmons Date: Tue, 5 Dec 2000 22:07:52 +0000 (+0000) Subject: Win32 PERL_IMPLICIT_SYS passes all tests with USE_PERLIO X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ce3e5b80724e7725765c5559e5f4b0058876fc19;p=p5sagit%2Fp5-mst-13.2.git Win32 PERL_IMPLICIT_SYS passes all tests with USE_PERLIO - calloc/free suffer from damage on TerminateThread() - use PerlMemShared (as originally planned) now fixed - avoid doing anything important on DLL "detach". p4raw-id: //depot/perlio@8001 --- diff --git a/perl.c b/perl.c index f1cda0e..1467df1 100644 --- a/perl.c +++ b/perl.c @@ -786,12 +786,18 @@ perl_free(pTHXx) #if defined(PERL_OBJECT) PerlMem_free(this); #else -# if defined(PERL_IMPLICIT_SYS) && defined(WIN32) +# if defined(WIN32) +# if defined(PERL_IMPLICIT_SYS) void *host = w32_internal_host; - if (PerlProc_lasthost()) + if (PerlProc_lasthost()) { PerlIO_cleanup(); + } PerlMem_free(aTHXx); win32_delete_internal_host(host); +#else + PerlIO_cleanup(); + PerlMem_free(aTHXx); +#endif # else PerlMem_free(aTHXx); # endif diff --git a/perlio.c b/perlio.c index d6b3b08..cd6a244 100644 --- a/perlio.c +++ b/perlio.c @@ -28,12 +28,6 @@ #define PERL_IN_PERLIO_C #include "perl.h" -#undef PerlMemShared_calloc -#define PerlMemShared_calloc(x,y) calloc(x,y) -#undef PerlMemShared_free -#define PerlMemShared_free(x) free(x) - - #ifndef PERLIO_LAYERS int PerlIO_apply_layers(pTHX_ PerlIO *f, const char *mode, const char *names) diff --git a/win32/perllib.c b/win32/perllib.c index 1a9fa9f..87b79c0 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -370,9 +370,12 @@ DllMain(HANDLE hModule, /* DLL module handle */ * process termination or call to FreeLibrary. */ case DLL_PROCESS_DETACH: -#if !defined(PERLIO_IS_STDIO) && !defined(USE_SFIO) - PerlIO_cleanup(); -#endif + /* As long as we use TerminateProcess()/TerminateThread() etc. for mimicing kill() + anything here had better be harmless if: + A. Not called at all. + B. Called after memory allocation for Heap has been forcibly removed by OS. + PerlIO_cleanup() was done here but fails (B). + */ EndSockets(); #if defined(USE_THREADS) || defined(USE_ITHREADS) if (PL_curinterp)