]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Explain the d_cachedir_mutex is only used for protecting init() calls 13969/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 27 Mar 2024 10:08:46 +0000 (11:08 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 27 Mar 2024 10:08:46 +0000 (11:08 +0100)
pdns/recursordist/nod.hh

index fb59c351005499433bf0cd852c63f0ef6e281292..1cc8f456dca3860b88aecf6c373b2707eb42f517 100644 (file)
@@ -69,7 +69,10 @@ private:
   LockGuarded<bf::stableBF> 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