r4796 - trunk/varnish-cache/bin/varnishd
phk at varnish-cache.org
phk at varnish-cache.org
Mon May 17 10:40:10 CEST 2010
Author: phk
Date: 2010-05-17 10:40:08 +0200 (Mon, 17 May 2010)
New Revision: 4796
Modified:
trunk/varnish-cache/bin/varnishd/common.h
Log:
Add preliminary macro for memory barriers
Modified: trunk/varnish-cache/bin/varnishd/common.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/common.h 2010-05-17 08:11:43 UTC (rev 4795)
+++ trunk/varnish-cache/bin/varnishd/common.h 2010-05-17 08:40:08 UTC (rev 4796)
@@ -70,3 +70,18 @@
};
#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
More information about the varnish-commit
mailing list