Add atomic(9) implementations of atomic operations.

Add atomic(9) implementations of atomic operations.  These are used on
FreeBSD for non-x86 architectures.
This commit is contained in:
Jason Evans
2012-04-17 13:17:54 -07:00
parent 45f208e112
commit b57d3ec571
4 changed files with 72 additions and 6 deletions

View File

@@ -980,6 +980,29 @@ if test "x${je_cv_function_ffsl}" != "xyes" ; then
AC_MSG_ERROR([Cannot build without ffsl(3)])
fi
dnl ============================================================================
dnl Check for atomic(9) operations as provided on FreeBSD.
JE_COMPILABLE([atomic(9)], [
#include <sys/types.h>
#include <machine/atomic.h>
#include <inttypes.h>
], [
{
uint32_t x32 = 0;
volatile uint32_t *x32p = &x32;
atomic_fetchadd_32(x32p, 1);
}
{
unsigned long xlong = 0;
volatile unsigned long *xlongp = &xlong;
atomic_fetchadd_long(xlongp, 1);
}
], [je_cv_atomic9])
if test "x${je_cv_atomic9}" = "xyes" ; then
AC_DEFINE([JEMALLOC_ATOMIC9])
fi
dnl ============================================================================
dnl Check for atomic(3) operations as provided on Darwin.
@@ -1031,7 +1054,7 @@ AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
fi
])
if test "x${je_cv_osatomic}" != "xyes" ; then
if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4)
JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8)
fi