aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/env.c
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2019-10-21 07:47:08 +0900
committerJustin M. Keyes <justinkz@gmail.com>2019-10-20 15:47:08 -0700
commit6fd6f4683d19d5ca18f48c1d1f0d87113e80368e (patch)
tree3182944f5f7a77f5dcb8bd43918f7a4ada8e4b19 /src/nvim/os/env.c
parent019c8d13dd7056725c0715dc15e451118b767b7d (diff)
downloadrneovim-6fd6f4683d19d5ca18f48c1d1f0d87113e80368e.tar.gz
rneovim-6fd6f4683d19d5ca18f48c1d1f0d87113e80368e.tar.bz2
rneovim-6fd6f4683d19d5ca18f48c1d1f0d87113e80368e.zip
TUI/thread: guard env map from potential race with unibilium #11259
unibi_from_term calls getenv internally, so exclusive control is required.
Diffstat (limited to 'src/nvim/os/env.c')
-rw-r--r--src/nvim/os/env.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index ae61e54993..eb86cb8ac7 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -44,6 +44,16 @@ void env_init(void)
uv_mutex_init(&mutex);
}
+void os_env_var_lock(void)
+{
+ uv_mutex_lock(&mutex);
+}
+
+void os_env_var_unlock(void)
+{
+ uv_mutex_unlock(&mutex);
+}
+
/// Like getenv(), but returns NULL if the variable is empty.
/// @see os_env_exists
const char *os_getenv(const char *name)