Skip to content

Commit

Permalink
fix: Move indices to avoid sharing cacheline with other members
Browse files Browse the repository at this point in the history
  • Loading branch information
DNedic committed Feb 26, 2024
1 parent 6df4fce commit 691344d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lfbb/inc/lfbb.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ extern "C" {
/*************************** TYPES ****************************/

typedef struct {
size_t size; /**< Size of the data array */
uint8_t *data; /**< Pointer to the 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 LFBB_MULTICORE_HOSTED
alignas(LFBB_CACHELINE_LENGTH) atomic_size_t r; /**< Read index */
alignas(LFBB_CACHELINE_LENGTH) atomic_size_t w; /**< Write index */
Expand All @@ -79,10 +83,6 @@ typedef struct {
atomic_size_t w; /**< Write index */
atomic_size_t i; /**< Invalidated space index */
#endif
size_t size; /**< Size of the data array */
uint8_t *data; /**< Pointer to the data array */
bool write_wrapped; /**< Write wrapped flag, used only in the producer */
bool read_wrapped; /**< Read wrapped flag, used only in the consumer */
} LFBB_Inst_Type;

/******************** FUNCTION PROTOTYPES *********************/
Expand Down

0 comments on commit 691344d

Please sign in to comment.