From a9cb45866043dd8f40d20bcc894c374aa14afbe6 Mon Sep 17 00:00:00 2001 From: Pedro Gonnet <gonnet@google.com> Date: Tue, 10 Nov 2015 21:23:21 +0000 Subject: [PATCH] Make sure that the stack entries in which we will store new data are actually ready to receive data. --- src/space.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/space.c b/src/space.c index dff22dba2f..73544daf7a 100644 --- a/src/space.c +++ b/src/space.c @@ -596,6 +596,7 @@ void space_do_parts_sort() { if (jj > i && pivot > min) { qid = atomic_inc(&space_sort_struct.last) % space_sort_struct.stack_size; + while (!space_sort_struct.stack[qid].ready); space_sort_struct.stack[qid].i = i; space_sort_struct.stack[qid].j = jj; space_sort_struct.stack[qid].min = min; @@ -619,6 +620,7 @@ void space_do_parts_sort() { if (pivot + 1 < max) { qid = atomic_inc(&space_sort_struct.last) % space_sort_struct.stack_size; + while (!space_sort_struct.stack[qid].ready); space_sort_struct.stack[qid].i = jj + 1; space_sort_struct.stack[qid].j = j; space_sort_struct.stack[qid].min = pivot + 1; @@ -1175,4 +1177,4 @@ void space_init(struct space *s, double dim[3], struct part *parts, int N, /* Build the cells and the tasks. */ space_regrid(s, h_max, verbose); -} +} \ No newline at end of file -- GitLab