From 487a1f08b7b48d69e8f414414f61a9ac2bd5adad Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Sun, 12 Jun 2016 19:28:03 +0200 Subject: [PATCH] Use atomic definitions --- src/map.c | 13 +++++++++++-- src/queue.c | 7 ------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/map.c b/src/map.c index fbe57fde7b..cb911c36f3 100644 --- a/src/map.c +++ b/src/map.c @@ -18,9 +18,18 @@ * ******************************************************************************/ -#include "map.h" +/* Config parameters. */ +#include "../config.h" + +/* Some standard headers. */ #include <stdio.h> #include <stdlib.h> + +/* This object's header. */ +#include "map.h" + +/* Local headers. */ +#include "atomic.h" #include "error.h" /** @@ -97,7 +106,7 @@ void map_cells_plot(struct cell *c, void *data) { void map_cellcheck(struct cell *c, void *data) { int *count = (int *)data; - __sync_fetch_and_add(count, c->count); + atomic_add(count, c->count); /* Loop over all parts and check if they are in the cell. */ for (int k = 0; k < c->count; k++) { diff --git a/src/queue.c b/src/queue.c index a62ded2561..57aa5701d9 100644 --- a/src/queue.c +++ b/src/queue.c @@ -38,13 +38,6 @@ #include "const.h" #include "error.h" -/* Counter macros. */ -#ifdef COUNTER -#define COUNT(c) (__sync_add_and_fetch(&queue_counter[c], 1)) -#else -#define COUNT(c) -#endif - /* The counters. */ int queue_counter[queue_counter_count]; -- GitLab