Call destructor for non-trivial destructors if arena allocator is used in ConcurrentS...
[folly.git] / folly / ConcurrentSkipList-inl.h
index 232baff059b410eb4ac7b582efb3ea101419afdd..48e3f63f3d86b107f70ffeba4caefaac98c837c9 100644 (file)
@@ -33,7 +33,7 @@
 #include <glog/logging.h>
 
 #include <folly/Memory.h>
-#include <folly/SmallLocks.h>
+#include <folly/MicroSpinLock.h>
 #include <folly/ThreadLocal.h>
 
 namespace folly { namespace detail {
@@ -73,7 +73,7 @@ class SkipListNode : private boost::noncopyable {
   template<typename NodeAlloc>
   static constexpr bool destroyIsNoOp() {
     return IsArenaAllocator<NodeAlloc>::value &&
-           boost::has_trivial_destructor<std::atomic<SkipListNode*>>::value;
+           boost::has_trivial_destructor<SkipListNode>::value;
   }
 
   // copy the head node to a new head node assuming lock acquired
@@ -236,6 +236,8 @@ class NodeRecycler<NodeType, NodeAlloc, typename std::enable_if<
   explicit NodeRecycler(const NodeAlloc& alloc)
     : refs_(0), dirty_(false), alloc_(alloc) { lock_.init(); }
 
+  explicit NodeRecycler() : refs_(0), dirty_(false) { lock_.init(); }
+
   ~NodeRecycler() {
     CHECK_EQ(refs(), 0);
     if (nodes_) {
@@ -322,7 +324,7 @@ class NodeRecycler<NodeType, NodeAlloc, typename std::enable_if<
   void addRef() { }
   void releaseRef() { }
 
-  void add(NodeType* node) { }
+  void add(NodeType* /* node */) {}
 
   NodeAlloc& alloc() { return alloc_; }