8 #ifndef PXR_BASE_TRACE_CONCURRENT_LIST_H
9 #define PXR_BASE_TRACE_CONCURRENT_LIST_H
15 #include <tbb/cache_aligned_allocator.h>
31 struct alignas(ARCH_CACHE_LINE_SIZE*2)
Node {
55 return _node ? &_node->value :
nullptr;
74 return _node != other._node;
78 return _node == other._node;
82 explicit iterator(Node* node) : _node(node) {}
93 Node* curNode = _head.load(std::memory_order_acquire);
95 Node* nodeToDelete = curNode;
96 curNode = curNode->next;
97 nodeToDelete->~Node();
98 _alloc.deallocate(nodeToDelete, 1);
108 iterator
begin() {
return iterator(_head.load(std::memory_order_acquire)); }
109 iterator
end() {
return iterator(); }
115 Node* newNode = _alloc.allocate(1);
120 newNode->next = _head.load(std::memory_order_relaxed);
121 }
while (!_head.compare_exchange_weak(newNode->next, newNode));
122 return iterator(newNode);
126 std::atomic<Node*> _head;
127 tbb::cache_aligned_allocator<Node> _alloc;
132 #endif // PXR_BASE_TRACE_CONCURRENT_LIST_H
std::forward_iterator_tag iterator_category
GLsizei const GLfloat * value
**But if you need a result
bool operator!=(const iterator &other) const
ptrdiff_t difference_type
Node(ElementPtr parent, const string &name)
TraceConcurrentList & operator=(const TraceConcurrentList &)=delete
TraceConcurrentList()
Constructor.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
~TraceConcurrentList()
Destructor.
bool operator==(const iterator &other) const