SUBDIRS = tests
include_HEADERS = urcu.h $(top_srcdir)/urcu-*.h
-nobase_dist_include_HEADERS = urcu/compiler.h urcu/hlist.h urcu/list.h urcu/rculist.h urcu/system.h
-nobase_nodist_include_HEADERS = urcu/arch.h urcu/uatomic_arch.h
+nobase_dist_include_HEADERS = urcu/compiler.h urcu/hlist.h urcu/list.h \
+ urcu/rculist.h urcu/system.h urcu/urcu-futex.h
+nobase_nodist_include_HEADERS = urcu/arch.h urcu/uatomic_arch.h urcu/config.h
EXTRA_DIST = $(top_srcdir)/urcu/arch_*.h $(top_srcdir)/urcu/uatomic_arch_*.h \
gpl-2.0.txt lgpl-2.1.txt lgpl-relicensing.txt \
COMPAT=
endif
+if COMPAT_FUTEX
+COMPAT+=compat_futex.c
+endif
lib_LTLIBRARIES = liburcu.la liburcu-mb.la liburcu-defer.la liburcu-qsbr.la liburcu-bp.la
AH_TEMPLATE([CONFIG_SMP], [Enable SMP support. With SMP support enabled, uniprocessors are also supported. With SMP support disabled, UP systems work fine, but the behavior of SMP systems is undefined.])
AH_TEMPLATE([CONFIG_HAVE_FENCE], [Defined when on a system that has memory fence
instructions.])
+AH_TEMPLATE([CONFIG_HAVE_FUTEX], [Defined when on a system with futex support.])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
fi
]
+AC_MSG_CHECKING([presence of sys_futex()])
+AC_TRY_COMPILE(
+[
+#include <sys/syscall.h>
+],
+[
+#ifndef __NR_futex
+#error "futexes not available"
+#endif
+],
+[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([CONFIG_HAVE_FUTEX], [1])
+ compat_futex_test=0
+]
+,
+[
+ AC_MSG_RESULT([no])
+ compat_futex_test=1
+]
+)
+
+AM_CONDITIONAL([COMPAT_FUTEX], [ test "x$compat_futex_test" = "x1" ])
+
AM_CONDITIONAL([GCC_API], [test "x$ARCHTYPE" != xx86 -a "x$ARCHTYPE" != xppc])
-AM_CONDITIONAL([COMPAT_ARCH], [test "x$SUBARCHTYPE" == xx86compat ])
+AM_CONDITIONAL([COMPAT_ARCH], [test "x$SUBARCHTYPE" = xx86compat ])
AC_ARG_ENABLE([smp-support], [ --disable-smp-support Disable SMP support. Warning: only use this
on uniprocessor systems. [[default=enabled]]], [def_smp_support=$enableval], [def_smp_support="yes"])
noinst_HEADERS = rcutorture.h
if COMPAT_ARCH
-COMPAT=$(top_builddir)/compat_arch_@ARCHTYPE@.c
+COMPAT=$(top_srcdir)/compat_arch_@ARCHTYPE@.c
else
COMPAT=
endif
+if COMPAT_FUTEX
+COMPAT+=$(top_srcdir)/compat_futex.c
+endif
+
URCU_SIGNAL=$(top_builddir)/urcu.c $(top_builddir)/urcu-pointer.c $(COMPAT)
# URCU_SIGNAL_YIELD uses urcu.c but -DDEBUG_YIELD must be defined
URCU_SIGNAL_YIELD=$(top_builddir)/urcu.c $(top_builddir)/urcu-pointer.c $(COMPAT)
#include <syscall.h>
#include <unistd.h>
+#include "urcu/urcu-futex.h"
#include "urcu-defer-static.h"
/* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
#include "urcu-defer.h"
-#define futex(...) syscall(__NR_futex, __VA_ARGS__)
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
-
void __attribute__((destructor)) urcu_defer_exit(void);
extern void synchronize_rcu(void);
{
if (unlikely(uatomic_read(&defer_thread_futex) == -1)) {
uatomic_set(&defer_thread_futex, 0);
- futex(&defer_thread_futex, FUTEX_WAKE, 1,
+ futex_noasync(&defer_thread_futex, FUTEX_WAKE, 1,
NULL, NULL, 0);
}
}
} else {
smp_rmb(); /* Read queue before read futex */
if (uatomic_read(&defer_thread_futex) == -1)
- futex(&defer_thread_futex, FUTEX_WAIT, -1,
+ futex_noasync(&defer_thread_futex, FUTEX_WAIT, -1,
NULL, NULL, 0);
}
}
#include <urcu/system.h>
#include <urcu/uatomic_arch.h>
#include <urcu/list.h>
-
-#define futex(...) syscall(__NR_futex, __VA_ARGS__)
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
+#include <urcu/urcu-futex.h>
/*
* This code section can only be included in LGPL 2.1 compatible source code.
{
if (unlikely(uatomic_read(&gp_futex) == -1)) {
uatomic_set(&gp_futex, 0);
- futex(&gp_futex, FUTEX_WAKE, 1,
+ futex_noasync(&gp_futex, FUTEX_WAKE, 1,
NULL, NULL, 0);
}
}
/* Read reader_gp before read futex */
smp_rmb();
if (uatomic_read(&gp_futex) == -1)
- futex(&gp_futex, FUTEX_WAIT, -1,
+ futex_noasync(&gp_futex, FUTEX_WAIT, -1,
NULL, NULL, 0);
}
#include <urcu/system.h>
#include <urcu/uatomic_arch.h>
#include <urcu/list.h>
-
-#define futex(...) syscall(__NR_futex, __VA_ARGS__)
-#define FUTEX_WAIT 0
-#define FUTEX_WAKE 1
+#include <urcu/urcu-futex.h>
/*
* This code section can only be included in LGPL 2.1 compatible source code.
{
if (unlikely(uatomic_read(&gp_futex) == -1)) {
uatomic_set(&gp_futex, 0);
- futex(&gp_futex, FUTEX_WAKE, 1,
+ futex_async(&gp_futex, FUTEX_WAKE, 1,
NULL, NULL, 0);
}
}
/* Read reader_gp before read futex */
force_mb_all_threads();
if (uatomic_read(&gp_futex) == -1)
- futex(&gp_futex, FUTEX_WAIT, -1,
+ futex_async(&gp_futex, FUTEX_WAIT, -1,
NULL, NULL, 0);
}