proxygen
folly::detail::ThreadCachedLists< Tag >::ListHead Struct Reference

#include <ThreadCachedLists.h>

Public Member Functions

template<typename Func >
void forEach (Func func)
 
void splice (ListHead &other)
 
void splice (AtomicListHead &other)
 

Public Attributes

Nodehead_ {nullptr}
 
Nodetail_ {nullptr}
 

Detailed Description

template<typename Tag>
struct folly::detail::ThreadCachedLists< Tag >::ListHead

Definition at line 50 of file ThreadCachedLists.h.

Member Function Documentation

template<typename Tag>
template<typename Func >
void folly::detail::ThreadCachedLists< Tag >::ListHead::forEach ( Func  func)
inline

Definition at line 56 of file ThreadCachedLists.h.

References folly::collect(), bm::list, and cpp.ast::next().

56  {
57  auto node = tail_;
58  while (node != nullptr) {
59  auto next = node->next_;
60  func(node);
61  node = next;
62  }
63  }
def next(obj)
Definition: ast.py:58
template<typename Tag >
void folly::detail::ThreadCachedLists< Tag >::ListHead::splice ( ListHead other)

Definition at line 154 of file ThreadCachedLists.h.

References folly::detail::ThreadCachedLists< Tag >::ListHead::head_, and folly::detail::ThreadCachedLists< Tag >::ListHead::tail_.

Referenced by folly::detail::ThreadCachedLists< Tag >::collect().

154  {
155  if (other.head_ != nullptr) {
156  DCHECK(other.tail_ != nullptr);
157  } else {
158  DCHECK(other.tail_ == nullptr);
159  return;
160  }
161 
162  if (head_) {
163  DCHECK(tail_ != nullptr);
164  DCHECK(head_->next_ == nullptr);
165  head_->next_ = other.tail_;
166  head_ = other.head_;
167  } else {
168  DCHECK(head_ == nullptr);
169  head_ = other.head_;
170  tail_ = other.tail_;
171  }
172 
173  other.head_ = nullptr;
174  other.tail_ = nullptr;
175 }
template<typename Tag >
void folly::detail::ThreadCachedLists< Tag >::ListHead::splice ( AtomicListHead other)

Definition at line 178 of file ThreadCachedLists.h.

References folly::detail::ThreadCachedLists< Tag >::AtomicListHead::head_, folly::detail::ThreadCachedLists< Tag >::ListHead::head_, folly::fibers::local(), folly::detail::ThreadCachedLists< Tag >::AtomicListHead::tail_, and folly::detail::ThreadCachedLists< Tag >::ListHead::tail_.

178  {
179  ListHead local;
180 
181  auto tail = list.tail_.load();
182  if (tail) {
183  local.tail_ = list.tail_.exchange(nullptr);
184  local.head_ = list.head_.exchange(nullptr);
185  splice(local);
186  }
187 }
Encoder::MutableCompressedList list

Member Data Documentation

template<typename Tag>
Node* folly::detail::ThreadCachedLists< Tag >::ListHead::head_ {nullptr}
template<typename Tag>
Node* folly::detail::ThreadCachedLists< Tag >::ListHead::tail_ {nullptr}

The documentation for this struct was generated from the following file: