From: Willy Tarreau Date: Tue, 31 Oct 2017 17:00:20 +0000 (+0100) Subject: MINOR: threads: add a portable barrier for threads and non-threads X-Git-Tag: v1.8-rc1~101 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b29dc95a9748732898996540768bbed7a01f9a03;p=thirdparty%2Fhaproxy.git MINOR: threads: add a portable barrier for threads and non-threads HA_BARRIER() is just a simple memory barrier to prevent the compiler from reordering our code. --- diff --git a/include/common/hathreads.h b/include/common/hathreads.h index 25c1737e1e..3524ef189c 100644 --- a/include/common/hathreads.h +++ b/include/common/hathreads.h @@ -60,6 +60,7 @@ extern THREAD_LOCAL unsigned int tid_bit; /* The bit corresponding to the thread *(val); \ }) +#define HA_BARRIER() do { } while (0) #define THREAD_SYNC_INIT(m) do { /* do nothing */ } while(0) #define THREAD_SYNC_ENABLE() do { /* do nothing */ } while(0) @@ -118,6 +119,8 @@ extern THREAD_LOCAL unsigned int tid_bit; /* The bit corresponding to the thread (*val); \ }) +#define HA_BARRIER() pl_barrier() + #define THREAD_SYNC_INIT(m) thread_sync_init(m) #define THREAD_SYNC_ENABLE() thread_sync_enable() #define THREAD_WANT_SYNC() thread_want_sync()