111 uint64_t new_tail = 0;
112 uint64_t old_commit = 0;
113 uint64_t old_tail = tail_.load(std::memory_order_acquire);
115 new_tail = old_tail + 1;
116 if (GetIndex(new_tail) == GetIndex(head_.load(std::memory_order_acquire))) {
119 }
while (!tail_.compare_exchange_weak(old_tail, new_tail,
120 std::memory_order_acq_rel,
121 std::memory_order_relaxed));
122 pool_[GetIndex(old_tail)] = element;
124 old_commit = old_tail;
126 old_commit, new_tail, std::memory_order_acq_rel,
127 std::memory_order_relaxed)));
128 wait_strategy_->NotifyOne();
134 uint64_t new_tail = 0;
135 uint64_t old_commit = 0;
136 uint64_t old_tail = tail_.load(std::memory_order_acquire);
138 new_tail = old_tail + 1;
139 if (GetIndex(new_tail) == GetIndex(head_.load(std::memory_order_acquire))) {
142 }
while (!tail_.compare_exchange_weak(old_tail, new_tail,
143 std::memory_order_acq_rel,
144 std::memory_order_relaxed));
145 pool_[GetIndex(old_tail)] = std::move(element);
147 old_commit = old_tail;
149 old_commit, new_tail, std::memory_order_acq_rel,
150 std::memory_order_relaxed)));
151 wait_strategy_->NotifyOne();
157 uint64_t new_head = 0;
158 uint64_t old_head = head_.load(std::memory_order_acquire);
160 new_head = old_head + 1;
161 if (new_head == commit_.load(std::memory_order_acquire)) {
164 *element = pool_[GetIndex(new_head)];
165 }
while (!head_.compare_exchange_weak(old_head, new_head,
166 std::memory_order_acq_rel,
167 std::memory_order_relaxed));