Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lockfree queue size and full check #203

Merged
merged 1 commit into from
Oct 26, 2023
Merged
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
5 changes: 4 additions & 1 deletion common/lockfree_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ struct Capacity_2expN<0> {
template <>
struct Capacity_2expN<1> : public Capacity_2expN<0> {};

template <>
struct Capacity_2expN<2> : public Capacity_2expN<0> {};

struct PauseBase {};

struct CPUPause : PauseBase {
Expand Down Expand Up @@ -136,7 +139,7 @@ class LockfreeRingQueueBase {
bool check_empty(size_t h, size_t t) const { return h == t; }

bool check_full(size_t h, size_t t) const {
return check_mask_equal(h, t + 1);
return h != t && check_mask_equal(h, t);
}

size_t idx(size_t x) const { return x & mask; }
Expand Down
Loading