ck_barrier_centralized: Unconditionally execute full barrier.

Any side-effects should be visible after barrier boundary
is crossed.
ck_pring
Samy Al Bahra 13 years ago
parent b220e50f54
commit 86411b9be8

@ -45,14 +45,15 @@ ck_barrier_centralized(struct ck_barrier_centralized *barrier,
value = ck_pr_faa_uint(&barrier->value, 1); value = ck_pr_faa_uint(&barrier->value, 1);
if (value == n_threads - 1) { if (value == n_threads - 1) {
ck_pr_store_uint(&barrier->value, 0); ck_pr_store_uint(&barrier->value, 0);
ck_pr_fence_store(); ck_pr_fence_memory();
ck_pr_store_uint(&barrier->sense, sense); ck_pr_store_uint(&barrier->sense, sense);
return; return;
} }
ck_pr_fence_memory(); ck_pr_fence_load();
while (sense != ck_pr_load_uint(&barrier->sense)) while (sense != ck_pr_load_uint(&barrier->sense))
ck_pr_stall(); ck_pr_stall();
ck_pr_fence_memory();
return; return;
} }

Loading…
Cancel
Save