diff --git a/drama/src/rev-mc.c b/drama/src/rev-mc.c index d448aae..3f225f4 100644 --- a/drama/src/rev-mc.c +++ b/drama/src/rev-mc.c @@ -370,15 +370,16 @@ find_row_mask(std::vector &sets, step_count -= std::min(step_count, step / 10); + // my is new if (my_pos > g_base_pos.load(std::memory_order_relaxed) + step_count) { std::lock_guard _(lock); if (my_pos > g_base_pos + step_count) { g_base_pos = my_pos; row_mask = cur_mask; } - } else { + } else if (g_base_pos.load(std::memory_order_relaxed) <= my_pos) { std::lock_guard _(lock); - if (g_base_pos + step_count <= my_pos) { + if (g_base_pos <= my_pos) { cur_mask = row_mask; step_count = my_pos - g_base_pos; }