Commit bbabe60c authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Don't become ready before entering a waiting state.

The waiting is done by testing readiness before waiting so there
is a window when nothing is waiting (probably near the end of the
sort), but we are still reading other stacks, which then get marked
as ready releasing the ready wait, so it's then just a timing game
as to whether the waiting wait is incremented in time... 99.999999%
of the time it is.
parent 2d9a2f22
......@@ -601,10 +601,10 @@ void space_do_parts_sort() {
space_sort_struct.stack[qid].j = jj;
space_sort_struct.stack[qid].min = min;
space_sort_struct.stack[qid].max = pivot;
space_sort_struct.stack[qid].ready = 1;
if (atomic_inc(&space_sort_struct.waiting) >=
space_sort_struct.stack_size)
error("Qstack overflow.");
space_sort_struct.stack[qid].ready = 1;
}
/* Recurse on the right? */
......@@ -625,10 +625,10 @@ void space_do_parts_sort() {
space_sort_struct.stack[qid].j = j;
space_sort_struct.stack[qid].min = pivot + 1;
space_sort_struct.stack[qid].max = max;
space_sort_struct.stack[qid].ready = 1;
if (atomic_inc(&space_sort_struct.waiting) >=
space_sort_struct.stack_size)
error("Qstack overflow.");
space_sort_struct.stack[qid].ready = 1;
}
/* Recurse on the left? */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment