diff --git a/src/kernel/environment.cpp b/src/kernel/environment.cpp index ab7ead794..fdf114b31 100644 --- a/src/kernel/environment.cpp +++ b/src/kernel/environment.cpp @@ -48,7 +48,7 @@ environment_id::environment_id():m_ptr(new path()), m_depth(0) {} environment_id::environment_id(environment_id const & ancestor, bool) { if (ancestor.m_depth == std::numeric_limits::max()) throw exception("maximal depth in is_descendant tree has been reached, use 'forget' method to workaround this limitation"); - unique_lock lock(ancestor.m_ptr->m_mutex); + lock_guard lock(ancestor.m_ptr->m_mutex); if (ancestor.m_ptr->m_next_depth == ancestor.m_depth + 1) { m_ptr = ancestor.m_ptr; m_depth = ancestor.m_depth + 1; diff --git a/src/library/shared_environment.cpp b/src/library/shared_environment.cpp index b60b76e10..96e90ef47 100644 --- a/src/library/shared_environment.cpp +++ b/src/library/shared_environment.cpp @@ -11,27 +11,27 @@ shared_environment::shared_environment() {} shared_environment::shared_environment(environment const & env):m_env(env) {} environment shared_environment::get_environment() const { - unique_lock l(m_mutex); + lock_guard l(m_mutex); return m_env; } void shared_environment::add(certified_declaration const & d) { - unique_lock l(m_mutex); + lock_guard l(m_mutex); m_env = m_env.add(d); } void shared_environment::add(declaration const & d) { - unique_lock l(m_mutex); + lock_guard l(m_mutex); m_env = m_env.add(d); } void shared_environment::replace(certified_declaration const & t) { - unique_lock l(m_mutex); + lock_guard l(m_mutex); m_env = m_env.replace(t); } void shared_environment::update(std::function const & f) { - unique_lock l(m_mutex); + lock_guard l(m_mutex); m_env = f(m_env); } }