summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-12-01 07:44:18 -0700
committerKarl Williamson <khw@cpan.org>2020-12-19 22:00:30 -0700
commit35bcf7ffa2bfeab79ab7b4eb0d35f462775b54d2 (patch)
treefeffc93e76297c539b0bc9985c2a88d626caf7e5 /inline.h
parent9d228af78ad17dabb51f9059d215cc88c059a22a (diff)
downloadperl-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.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/inline.h b/inline.h
index c18637208f..dbfb89a6b0 100644
--- a/inline.h
+++ b/inline.h
@@ -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;
}