mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Add a C11 atomics-based implementation of atomic.h API.
This commit is contained in:
committed by
Jason Evans
parent
a18c2b1f15
commit
59cd80e6c6
21
configure.ac
21
configure.ac
@@ -1199,6 +1199,27 @@ elif test "x${force_tls}" = "x1" ; then
|
||||
AC_MSG_ERROR([Failed to configure TLS, which is mandatory for correct function])
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Check for C11 atomics.
|
||||
|
||||
JE_COMPILABLE([C11 atomics], [
|
||||
#include <stdint.h>
|
||||
#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
|
||||
#include <stdatomic.h>
|
||||
#else
|
||||
#error Atomics not available
|
||||
#endif
|
||||
], [
|
||||
uint64_t *p = (uint64_t *)0;
|
||||
uint64_t x = 1;
|
||||
volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
|
||||
uint64_t r = atomic_fetch_add(a, x) + x;
|
||||
return (r == 0);
|
||||
], [je_cv_c11atomics])
|
||||
if test "x${je_cv_c11atomics}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_C11ATOMICS])
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Check for atomic(9) operations as provided on FreeBSD.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user