#include <atomic>
#include <folly/Function.h>
+#include <folly/Synchronized.h>
#include <folly/ThreadLocal.h>
#include <glog/logging.h>
// Push list to the global list.
void pushGlobal(ListHead& list);
- ListHead ghead_;
+ folly::Synchronized<ListHead> ghead_;
struct TLHead : public AtomicListHead {
ThreadCachedLists* parent_;
TLHead(ThreadCachedLists* parent) : parent_(parent) {}
~TLHead() {
- parent_->ghead_.splice(*this);
+ parent_->ghead_->splice(*this);
}
};
list.splice(thr);
}
- list.splice(ghead_);
+ list.splice(*ghead_.wlock());
}
template <typename Tag>