Skip to content

Commit

Permalink
fix(BipartiteBuf): Move boolean flags to avoid sharing cacheline with…
Browse files Browse the repository at this point in the history
… indices
  • Loading branch information
DNedic committed Feb 23, 2024
1 parent c430710 commit fbf2a60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lockfree/spsc/bipartite_buf.hpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ template <typename T, size_t size> class BipartiteBuf {

/********************** PRIVATE MEMBERS ***********************/
private:
T _data[size]; /**< Data array */
T _data[size]; /**< Data array */
bool _write_wrapped; /**< Write wrapped flag, used only in the producer */
bool _read_wrapped; /**< Read wrapped flag, used only in the consumer */
#if LOCKFREE_CACHE_COHERENT
alignas(LOCKFREE_CACHELINE_LENGTH) std::atomic_size_t _r; /**< Read index */
alignas(
Expand All @@ -150,8 +152,6 @@ template <typename T, size_t size> class BipartiteBuf {
std::atomic_size_t _w; /**< Write index */
std::atomic_size_t _i; /**< Invalidated space index */
#endif
bool _write_wrapped; /**< Write wrapped flag, used only in the producer */
bool _read_wrapped; /**< Read wrapped flag, used only in the consumer */
};

} /* namespace spsc */
Expand Down

0 comments on commit fbf2a60

Please sign in to comment.