Minimize false sharing of MPMC queue variables

This commit is contained in:
Robin Gareus 2021-06-07 23:38:53 +02:00
parent 5cec55da2e
commit bed992d55f
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04

View file

@ -199,16 +199,14 @@ private:
T _data;
};
typedef char cacheline_pad_t[64];
cacheline_pad_t _pad0;
char _pad0[64];
cell_t* _buffer;
size_t _buffer_mask;
cacheline_pad_t _pad1;
char _pad1[64 - sizeof (cell_t*) - sizeof (size_t)];
MPMC_QUEUE_TYPE _enqueue_pos;
cacheline_pad_t _pad2;
char _pad2[64 - sizeof (size_t)];
MPMC_QUEUE_TYPE _dequeue_pos;
cacheline_pad_t _pad3;
char _pad3[64 - sizeof (size_t)];
};
} // namespace PBD