From a068ba5eb3ab2e53b7d37cb972f425a64deaecde Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Wed, 27 Mar 2024 11:08:46 +0100 Subject: [PATCH] Explain the d_cachedir_mutex is only used for protecting init() calls --- pdns/recursordist/nod.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pdns/recursordist/nod.hh b/pdns/recursordist/nod.hh index fb59c35100..1cc8f456dc 100644 --- a/pdns/recursordist/nod.hh +++ b/pdns/recursordist/nod.hh @@ -69,7 +69,10 @@ private: LockGuarded d_sbf; // Stable Bloom Filter std::string d_cachedir; std::string d_prefix = sbf_prefix; - static std::mutex d_cachedir_mutex; // One mutex for all instances of this class + // One mutex for all instances of this class, used to avoid multiple init() calls happening + // simulateneously. The snapshot code is thread safe wrt file operations, so it does not need to + // acquire this mutex, assuming the init() code never runs simulatenously with the snapshot code. + static std::mutex d_cachedir_mutex; }; class NODDB -- 2.47.2