diff options
author | Ilya Zakharevich <ilya@math.berkeley.edu> | 1997-11-25 15:59:16 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-11-25 15:59:16 +0000 |
commit | 18f739eeef869ffadc3775821df62e4b90bf75b0 (patch) | |
tree | 53cd79aed73f55f7b2876741c2fb27786134a75a | |
parent | d0066dc7de72349a42c2c47e1fc66da2ba66542a (diff) | |
download | perl-18f739eeef869ffadc3775821df62e4b90bf75b0.tar.gz |
Move malloc_mutex initialisation/destruction:
Subject: patch to 5.004_54 for pthreads with Perl's malloc
p4raw-id: //depot/perl@299
-rw-r--r-- | malloc.c | 1 | ||||
-rw-r--r-- | os2/os2.c | 1 | ||||
-rw-r--r-- | os2/os2ish.h | 2 | ||||
-rw-r--r-- | perl.c | 2 | ||||
-rw-r--r-- | perl.h | 8 | ||||
-rw-r--r-- | plan9/plan9ish.h | 4 | ||||
-rw-r--r-- | unixish.h | 6 | ||||
-rw-r--r-- | vms/vmsish.h | 4 |
8 files changed, 18 insertions, 10 deletions
@@ -191,6 +191,7 @@ emergency_sbrk(size) } if (!emergency_buffer) { + dTHR; /* First offense, give a possibility to recover by dieing. */ /* No malloc involved here: */ GV **gvp = (GV**)hv_fetch(defstash, "^M", 2, 0); @@ -1147,6 +1147,7 @@ Perl_OS2_init(char **env) { char *shell; + MALLOC_INIT; settmppath(); OS2_Perl_data.xs_init = &Xs_OS2_init; if (environ == NULL) { diff --git a/os2/os2ish.h b/os2/os2ish.h index b62e3d04d4..9a3d267ae5 100644 --- a/os2/os2ish.h +++ b/os2/os2ish.h @@ -74,7 +74,7 @@ void Perl_OS2_init(char **); _wildcard(argcp, argvp); \ Perl_OS2_init(env); } STMT_END -#define PERL_SYS_TERM() +#define PERL_SYS_TERM() MALLOC_TERM /* #define PERL_SYS_TERM() STMT_START { \ if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */ @@ -134,7 +134,6 @@ perl_construct(register PerlInterpreter *sv_interp) if (pthread_key_create(&thr_key, 0)) croak("panic: pthread_key_create"); #endif - MUTEX_INIT(&malloc_mutex); MUTEX_INIT(&sv_mutex); /* * Safe to use basic SV functions from now on (though @@ -529,7 +528,6 @@ perl_destruct(register PerlInterpreter *sv_interp) DEBUG_P(debprofdump()); #ifdef USE_THREADS MUTEX_DESTROY(&sv_mutex); - MUTEX_DESTROY(&malloc_mutex); MUTEX_DESTROY(&eval_mutex); COND_DESTROY(&eval_cond); @@ -1343,6 +1343,14 @@ typedef Sighandler_t Sigsave_t; # define RUNOPS_DEFAULT runops_standard #endif +#ifdef MYMALLOC +# define MALLOC_INIT MUTEX_INIT(&malloc_mutex) +# define MALLOC_TERM MUTEX_DESTROY(&malloc_mutex) +#else +# define MALLOC_INIT +# define MALLOC_TERM +#endif + /* * These need prototyping here because <proto.h> isn't * included until after runops is initialised. diff --git a/plan9/plan9ish.h b/plan9/plan9ish.h index 3a5ad5eb1a..9c8bd5049f 100644 --- a/plan9/plan9ish.h +++ b/plan9/plan9ish.h @@ -98,9 +98,9 @@ #define ABORT() kill(getpid(),SIGABRT); #define BIT_BUCKET "/dev/null" -#define PERL_SYS_INIT(c,v) +#define PERL_SYS_INIT(c,v) MALLOC_INIT #define dXSUB_SYS -#define PERL_SYS_TERM() +#define PERL_SYS_TERM() MALLOC_TERM /* * fwrite1() should be a routine with the same calling sequence as fwrite(), @@ -109,14 +109,14 @@ #ifndef PERL_SYS_INIT #ifdef PERL_SCO5 /* this should be set in a hint file, not here */ -# define PERL_SYS_INIT(c,v) fpsetmask(0) +# define PERL_SYS_INIT(c,v) fpsetmask(0); MALLOC_INIT #else -# define PERL_SYS_INIT(c,v) +# define PERL_SYS_INIT(c,v) MALLOC_INIT #endif #endif #ifndef PERL_SYS_TERM -#define PERL_SYS_TERM() +#define PERL_SYS_TERM() MALLOC_TERM #endif #define BIT_BUCKET "/dev/null" diff --git a/vms/vmsish.h b/vms/vmsish.h index 410031cca3..f0de807920 100644 --- a/vms/vmsish.h +++ b/vms/vmsish.h @@ -233,8 +233,8 @@ #endif #define BIT_BUCKET "_NLA0:" -#define PERL_SYS_INIT(c,v) vms_image_init((c),(v)) -#define PERL_SYS_TERM() +#define PERL_SYS_INIT(c,v) vms_image_init((c),(v)), MALLOC_INIT +#define PERL_SYS_TERM() MALLOC_TERM #define dXSUB_SYS #define HAS_KILL #define HAS_WAIT |