#include <unistd.h>
#include <stdio.h>
#include <assert.h>
-#include <sys/syscall.h>
#include <sched.h>
#include <errno.h>
#include <urcu/arch.h>
+#ifdef __linux__
+#include <syscall.h>
+#endif
+
/* hardcoded number of CPUs */
#define NR_CPUS 16384
static inline void loop_sleep(unsigned long l)
{
while(l-- != 0)
- cpu_relax();
+ caa_cpu_relax();
}
static int verbose_mode;
static unsigned int nr_enqueuers;
static unsigned int nr_dequeuers;
-static struct wfs_stack s;
+static struct cds_wfs_stack s;
void *thr_enqueuer(void *_count)
{
cmm_smp_mb();
for (;;) {
- struct wfs_node *node = malloc(sizeof(*node));
+ struct cds_wfs_node *node = malloc(sizeof(*node));
if (!node)
goto fail;
- wfs_node_init(node);
- wfs_push(&s, node);
+ cds_wfs_node_init(node);
+ cds_wfs_push(&s, node);
nr_successful_enqueues++;
- if (unlikely(wdelay))
+ if (caa_unlikely(wdelay))
loop_sleep(wdelay);
fail:
nr_enqueues++;
- if (unlikely(!test_duration_enqueue()))
+ if (caa_unlikely(!test_duration_enqueue()))
break;
}
cmm_smp_mb();
for (;;) {
- struct wfs_node *node = wfs_pop_blocking(&s);
+ struct cds_wfs_node *node = cds_wfs_pop_blocking(&s);
if (node) {
free(node);
}
nr_dequeues++;
- if (unlikely(!test_duration_dequeue()))
+ if (caa_unlikely(!test_duration_dequeue()))
break;
- if (unlikely(rduration))
+ if (caa_unlikely(rduration))
loop_sleep(rduration);
}
return ((void*)2);
}
-void test_end(struct wfs_stack *s, unsigned long long *nr_dequeues)
+void test_end(struct cds_wfs_stack *s, unsigned long long *nr_dequeues)
{
- struct wfs_node *node;
+ struct cds_wfs_node *node;
do {
- node = wfs_pop_blocking(s);
+ node = cds_wfs_pop_blocking(s);
if (node) {
free(node);
(*nr_dequeues)++;
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers);
count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers);
- wfs_init(&s);
+ cds_wfs_init(&s);
next_aff = 0;