Register singleton's destruction using std::atexit
[folly.git] / folly / CachelinePadded.h
index fe362a8375a65bf738015b4b3ba307aa5fc34102..27a06b4a917bbd96b1dcd9e16bf34616b9fb92ae 100644 (file)
@@ -17,8 +17,9 @@
 #pragma once
 
 #include <cstddef>
+#include <utility>
 
-#include <folly/concurrency/CacheLocality.h>
+#include <folly/lang/Align.h>
 
 namespace folly {
 
@@ -32,8 +33,8 @@ namespace folly {
 template <typename T>
 class CachelinePadded {
   static_assert(
-      alignof(T) < CacheLocality::kFalseSharingRange,
-      "CachelinePadded does not support types aligned >= a cache-line.");
+      alignof(T) <= max_align_v,
+      "CachelinePadded does not support over-aligned types.");
 
  public:
   template <typename... Args>
@@ -66,11 +67,11 @@ class CachelinePadded {
 
  private:
   static constexpr size_t paddingSize() noexcept {
-    return CacheLocality::kFalseSharingRange -
-        (alignof(T) % CacheLocality::kFalseSharingRange);
+    return hardware_destructive_interference_size -
+        (alignof(T) % hardware_destructive_interference_size);
   }
   char paddingPre_[paddingSize()];
   T inner_;
   char paddingPost_[paddingSize()];
 };
-}
+} // namespace folly