diff --git a/ddtrace/internal/datadog/profiling/stack_v2/echion/echion/strings.h b/ddtrace/internal/datadog/profiling/stack_v2/echion/echion/strings.h index af584b80456..b5c589c8d33 100644 --- a/ddtrace/internal/datadog/profiling/stack_v2/echion/echion/strings.h +++ b/ddtrace/internal/datadog/profiling/stack_v2/echion/echion/strings.h @@ -139,12 +139,12 @@ class StringTable : public std::unordered_map return k; }; - [[nodiscard]] inline Result> lookup(Key key) + [[nodiscard]] inline Result> lookup(Key key) const { const std::lock_guard lock(table_lock); - auto it = this->find(key); - if (it == this->end()) + const auto it = this->find(key); + if (it == this->cend()) return ErrorKind::LookupError; return std::ref(it->second); @@ -159,7 +159,7 @@ class StringTable : public std::unordered_map }; private: - std::mutex table_lock; + mutable std::mutex table_lock; }; // We make this a reference to a heap-allocated object so that we can avoid