This commit is contained in:
tqcq 2024-10-26 13:04:02 +00:00
parent 449d2b008f
commit fa63c9daac

View File

@ -362,19 +362,24 @@ find_row_mask(std::vector<set_t> &sets,
} }
diff -= std::min(inner_step, diff); diff -= std::min(inner_step, diff);
std::lock_guard<std::mutex> _(lock);
if (end_pos - diff > g_base_pos) { if (end_pos - diff > g_base_pos) {
std::lock_guard<std::mutex> _(lock);
if (found) { break; } if (found) { break; }
g_base_pos = end_pos - diff; if (end_pos - diff > g_base_pos) {
row_mask = cur_mask; g_base_pos = end_pos - diff;
row_mask = cur_mask;
}
} else if (end_pos >= g_base_pos) { } else if (end_pos >= g_base_pos) {
diff = end_pos - g_base_pos; std::lock_guard<std::mutex> _(lock);
cur_mask = row_mask; if (end_pos >= g_base_pos) {
diff = end_pos - g_base_pos;
cur_mask = row_mask;
}
} }
} }
for (int i = outer_step; i > 0 && cur_mask < last_mask; --i) { for (int i = outer_step; i > 0 && cur_mask < last_mask; --i) {
if (resolve(cur_mask)) { if (resolve(cur_mask) && !found) {
bool expected = false; bool expected = false;
if (found.compare_exchange_strong(expected, true)) { if (found.compare_exchange_strong(expected, true)) {
std::lock_guard<std::mutex> _(lock); std::lock_guard<std::mutex> _(lock);