diff options
author | Karl Williamson <khw@cpan.org> | 2020-12-01 07:44:18 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-12-19 22:00:30 -0700 |
commit | 35bcf7ffa2bfeab79ab7b4eb0d35f462775b54d2 (patch) | |
tree | feffc93e76297c539b0bc9985c2a88d626caf7e5 /inline.h | |
parent | 9d228af78ad17dabb51f9059d215cc88c059a22a (diff) | |
download | perl-35bcf7ffa2bfeab79ab7b4eb0d35f462775b54d2.tar.gz |
Add GETENV_LOCK
get_env() needs to lock other threads from writing to the environment
while it is executing. It may need to have an exclusive lock if those
threads can clobber its buffer before it gets a chance to save them.
The previous commit has added a Configure probe which tells us if that
is the case. This commit uses it to select which type of mutex to use.
Diffstat (limited to 'inline.h')
-rw-r--r-- | inline.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2654,7 +2654,7 @@ Perl_mortal_getenv(const char * str) return getenv(str); } - ENV_LOCK; + GETENV_LOCK; ret = getenv(str); @@ -2662,7 +2662,8 @@ Perl_mortal_getenv(const char * str) ret = SvPVX(sv_2mortal(newSVpv(ret, 0))); } - ENV_UNLOCK; + GETENV_UNLOCK; + return ret; } |