From 8bb5f5475e059c9f32fb8eb5cf0cb2ea019298af Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 15 Aug 2018 10:21:23 +0200 Subject: [PATCH] Avoid putting the push mutex & the pop mutex inside the same cache line. Avoid false sharing for multi-threading scenario and should increase performance. --- m-buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m-buffer.h b/m-buffer.h index 5feeb78f..9d802539 100644 --- a/m-buffer.h +++ b/m-buffer.h @@ -99,9 +99,9 @@ typedef enum { \ typedef struct M_C(name, _s) { \ m_mutex_t mutexPush; \ - m_mutex_t mutexPop; \ m_cond_t there_is_data; \ m_cond_t there_is_room_for_data; \ + m_mutex_t mutexPop; \ BUFFERI_IF_CTE_SIZE(m_size)( ,size_t size;) \ size_t idx_prod, idx_cons, overwrite; \ atomic_ulong number[1 + BUFFERI_POLICY_P(policy, BUFFER_DEFERRED_POP)]; \