MCPcopy Create free account
hub / github.com/cameron314/readerwriterqueue / alloc_node

Method alloc_node

benchmarks/ext/1024cores/spscqueue.h:114–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112 node* tail_copy_; // helper (points somewhere between first_ and tail_)
113
114 node* alloc_node()
115 {
116 // first tries to allocate node from internal node cache,
117 // if attempt fails, allocates node via ::operator new()
118
119 if (first_ != tail_copy_)
120 {
121 node* n = first_;
122 first_ = first_->next_;
123 return n;
124 }
125 tail_copy_ = load_consume(&tail_);
126 if (first_ != tail_copy_)
127 {
128 node* n = first_;
129 first_ = first_->next_;
130 return n;
131 }
132 node* n = new node;
133 return n;
134 }
135
136 spsc_queue(spsc_queue const&);
137 spsc_queue& operator = (spsc_queue const&);

Callers

nothing calls this directly

Calls 1

load_consumeFunction · 0.85

Tested by

no test coverage detected