Commit 63c758a4 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add preliminary macro for memory barriers



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4796 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 51e8961f
......@@ -70,3 +70,18 @@ struct choice {
};
#define NEEDLESS_RETURN(foo) return (foo)
/**********************************************************************
* Guess what: There is no POSIX standard for memory barriers.
* XXX: Please try to find the minimal #ifdef to use here, rely on OS
* supplied facilities if at all possible, to avoid descending into the
* full cpu/compiler explosion.
*/
#ifdef __FreeBSD__
#include <machine/atomic.h>
#define MEMORY_BARRIER() mb()
#else
#warn "MEMORY_BARRIER() is expensive"
#define MEMORY_BARRIER() close(-1)
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment