liburcu_cds_common_la_SOURCES = wfqueue.c wfstack.c $(COMPAT)
liburcu_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT)
-liburcu_la_LIBADD = liburcu-cds-common.la
liburcu_cds_la_SOURCES = rculfqueue.c rculfstack.c $(COMPAT)
liburcu_qsbr_la_SOURCES = urcu-qsbr.c urcu-pointer.c $(COMPAT)
-liburcu_qsbr_la_LIBADD = liburcu-cds-common.la
liburcu_cds_qsbr_la_SOURCES = rculfqueue.c rculfstack.c $(COMPAT)
liburcu_cds_qsbr_la_CFLAGS = -DRCU_QSBR
liburcu_mb_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT)
liburcu_mb_la_CFLAGS = -DRCU_MB
-liburcu_mb_la_LIBADD = liburcu-cds-common.la
liburcu_cds_mb_la_SOURCES = rculfqueue.c rculfstack.c $(COMPAT)
liburcu_cds_mb_la_CFLAGS = -DRCU_MB
liburcu_signal_la_SOURCES = urcu.c urcu-pointer.c $(COMPAT)
liburcu_signal_la_CFLAGS = -DRCU_SIGNAL
-liburcu_signal_la_LIBADD = liburcu-cds-common.la
liburcu_cds_signal_la_SOURCES = rculfqueue.c rculfstack.c $(COMPAT)
liburcu_cds_signal_la_CFLAGS = -DRCU_SIGNAL
liburcu_bp_la_SOURCES = urcu-bp.c urcu-pointer.c $(COMPAT)
-liburcu_bp_la_LIBADD = liburcu-cds-common.la
liburcu_cds_bp_la_SOURCES = rculfqueue.c rculfstack.c $(COMPAT)
liburcu_cds_bp_la_CFLAGS = -DRCU_BP
*/
#define _GNU_SOURCE
+#define _LGPL_SOURCE
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
#include <unistd.h>
#include <sys/mman.h>
+#include "urcu/wfqueue.h"
#include "urcu/map/urcu-bp.h"
-
#include "urcu/static/urcu-bp.h"
+
/* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
+#undef _LGPL_SOURCE
#include "urcu-bp.h"
+#define _LGPL_SOURCE
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
*/
#define _GNU_SOURCE
+#define _LGPL_SOURCE
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
#include <errno.h>
#include <poll.h>
+#include "urcu/wfqueue.h"
#include "urcu/map/urcu-qsbr.h"
-
#define BUILD_QSBR_LIB
#include "urcu/static/urcu-qsbr.h"
+
/* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
+#undef _LGPL_SOURCE
#include "urcu-qsbr.h"
+#define _LGPL_SOURCE
void __attribute__((destructor)) rcu_exit(void);
#define _BSD_SOURCE
#define _GNU_SOURCE
+#define _LGPL_SOURCE
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
#include <errno.h>
#include <poll.h>
+#include "urcu/wfqueue.h"
#include "urcu/map/urcu.h"
-
#include "urcu/static/urcu.h"
+
/* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
+#undef _LGPL_SOURCE
#include "urcu.h"
+#define _LGPL_SOURCE
/*
* If a reader is really non-cooperative and refuses to commit its
s->head = NULL;
}
+/*
+ * Lock-free stack push is not subject to ABA problem, so no need to
+ * take the RCU read-side lock. Even if "head" changes between two
+ * uatomic_cmpxchg() invocations here (being popped, and then pushed
+ * again by one or more concurrent threads), the second
+ * uatomic_cmpxchg() invocation only cares about pushing a new entry at
+ * the head of the stack, ensuring consistency by making sure the new
+ * node->next is the same pointer value as the value replaced as head.
+ * It does not care about the content of the actual next node, so it can
+ * very well be reallocated between the two uatomic_cmpxchg().
+ *
+ * We take the approach of expecting the stack to be usually empty, so
+ * we first try an initial uatomic_cmpxchg() on a NULL old_head, and
+ * retry if the old head was non-NULL (the value read by the first
+ * uatomic_cmpxchg() is used as old head for the following loop). The
+ * upside of this scheme is to minimize the amount of cacheline traffic,
+ * always performing an exclusive cacheline access, rather than doing
+ * non-exclusive followed by exclusive cacheline access (which would be
+ * required if we first read the old head value). This design decision
+ * might be revisited after more throrough benchmarking on various
+ * platforms.
+ */
static inline
void _cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, struct cds_lfs_node_rcu *node)
{