25 #ifndef PXR_BASE_TRACE_CONCURRENT_LIST_H
26 #define PXR_BASE_TRACE_CONCURRENT_LIST_H
32 #include <tbb/cache_aligned_allocator.h>
48 struct alignas(ARCH_CACHE_LINE_SIZE*2)
Node {
72 return _node ? &_node->value :
nullptr;
91 return _node != other._node;
95 return _node == other._node;
99 explicit iterator(Node* node) : _node(node) {}
110 Node* curNode = _head.load(std::memory_order_acquire);
112 Node* nodeToDelete = curNode;
113 curNode = curNode->next;
114 _alloc.destroy(nodeToDelete);
115 _alloc.deallocate(nodeToDelete, 1);
125 iterator
begin() {
return iterator(_head.load(std::memory_order_acquire)); }
126 iterator
end() {
return iterator(); }
132 Node* newNode = _alloc.allocate(1);
133 _alloc.construct(newNode);
137 newNode->next = _head.load(std::memory_order_relaxed);
138 }
while (!_head.compare_exchange_weak(newNode->next, newNode));
139 return iterator(newNode);
143 std::atomic<Node*> _head;
144 tbb::cache_aligned_allocator<Node> _alloc;
149 #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