diff --git a/src/ck_barrier_centralized.c b/src/ck_barrier_centralized.c index ef9f96c..50a8b09 100644 --- a/src/ck_barrier_centralized.c +++ b/src/ck_barrier_centralized.c @@ -45,14 +45,15 @@ ck_barrier_centralized(struct ck_barrier_centralized *barrier, value = ck_pr_faa_uint(&barrier->value, 1); if (value == n_threads - 1) { ck_pr_store_uint(&barrier->value, 0); - ck_pr_fence_store(); + ck_pr_fence_memory(); ck_pr_store_uint(&barrier->sense, sense); return; } - ck_pr_fence_memory(); + ck_pr_fence_load(); while (sense != ck_pr_load_uint(&barrier->sense)) ck_pr_stall(); + ck_pr_fence_memory(); return; }