Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions include/exec/__detail/__bwos_lifo_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ namespace exec::bwos {
auto lifo_queue<Tp, Allocator>::steal_front() noexcept -> Tp {
std::size_t thief = 0;
do {
thief = thief_block_.load(stdexec::__std::memory_order_relaxed);
thief = thief_block_.load(stdexec::__std::memory_order_acquire);
std::size_t thief_index = thief & mask_;
block_type &block = blocks_[thief_index];
fetch_result result = block.steal();
Expand Down Expand Up @@ -257,7 +257,7 @@ namespace exec::bwos {
if (thief_counter == predecessor) {
predecessor += blocks_.size();
thief_counter += blocks_.size() - 1ul;
thief_block_.store(thief_counter, stdexec::__std::memory_order_relaxed);
thief_block_.store(thief_counter, stdexec::__std::memory_order_release);
}
owner_block_.store(predecessor, stdexec::__std::memory_order_relaxed);
return true;
Expand Down Expand Up @@ -296,7 +296,7 @@ namespace exec::bwos {
block_type &next_block = blocks_[next_index];
if (next_block.is_stealable()) {
thief_block_
.compare_exchange_strong(thief_counter, next_counter, stdexec::__std::memory_order_relaxed);
.compare_exchange_strong(thief_counter, next_counter, stdexec::__std::memory_order_acq_rel);
return true;
}
return thief_block_.load(stdexec::__std::memory_order_relaxed) != thief_counter;
Expand Down Expand Up @@ -409,7 +409,7 @@ namespace exec::bwos {
if (front == block_size()) [[unlikely]] {
return {lifo_queue_error_code::done, nullptr};
}
std::uint64_t back = tail_.load(stdexec::__std::memory_order_relaxed);
std::uint64_t back = tail_.load(stdexec::__std::memory_order_acquire);
if (front == back) [[unlikely]] {
return {lifo_queue_error_code::empty, nullptr};
}
Expand All @@ -420,7 +420,7 @@ namespace exec::bwos {

template <class Tp, class Allocator>
auto lifo_queue<Tp, Allocator>::block_type::steal() noexcept -> fetch_result<Tp> {
std::uint64_t spos = steal_tail_.load(stdexec::__std::memory_order_relaxed);
std::uint64_t spos = steal_head_.load(stdexec::__std::memory_order_acquire);
fetch_result<Tp> result{};
if (spos == block_size()) [[unlikely]] {
result.status = lifo_queue_error_code::done;
Expand All @@ -432,7 +432,7 @@ namespace exec::bwos {
return result;
}
if (!steal_tail_
.compare_exchange_strong(spos, spos + 1, stdexec::__std::memory_order_relaxed)) {
.compare_exchange_strong(spos, spos + 1, stdexec::__std::memory_order_acquire)) {
result.status = lifo_queue_error_code::conflict;
return result;
}
Expand All @@ -444,7 +444,7 @@ namespace exec::bwos {

template <class Tp, class Allocator>
auto lifo_queue<Tp, Allocator>::block_type::takeover() noexcept -> takeover_result {
std::uint64_t spos = steal_tail_.exchange(block_size(), stdexec::__std::memory_order_relaxed);
std::uint64_t spos = steal_tail_.exchange(block_size(), stdexec::__std::memory_order_acq_rel);
if (spos == block_size()) [[unlikely]] {
return {
.front = static_cast<std::size_t>(head_.load(stdexec::__std::memory_order_relaxed)),
Expand Down
Loading