feat: update

This commit is contained in:
tqcq 2024-10-26 10:14:29 +00:00
parent a53cedd6d5
commit c074264780

View File

@ -358,19 +358,20 @@ find_row_mask(std::vector<set_t> &sets,
while (cur_mask < last_mask && step_count > 0 && !found.load(std::memory_order_relaxed)) {
for (int i = std::min(step_count, step); i > 0 && cur_mask < last_mask; --i) {
cur_mask = next_bit_permutation(cur_mask);
if (cnt.fetch_add(1) % 10000 == 0) {
fprintf(stderr, "cnt : %5ld\n", cnt.load(std::memory_order_relaxed));
if (cnt.fetch_add(1) % 1000000000 == 0) {
fprintf(stderr, "cnt : %ld, step_count: %5ld\n", cnt.load(std::memory_order_relaxed),
step_count);
}
}
step_count -= std::min(step_count, step);
if (my_pos > g_base_pos) {
if (my_pos > g_base_pos.load(std::memory_order_relaxed)) {
std::lock_guard<std::mutex> _(lock);
if (my_pos > g_base_pos) {
g_base_pos = my_pos;
row_mask = cur_mask;
}
} else if (g_base_pos <= g_cur_pos) {
} else if (g_base_pos.load(std::memory_order_relaxed) < g_cur_pos.load(std::memory_order_relaxed)) {
std::lock_guard<std::mutex> _(lock);
if (g_base_pos < g_cur_pos) {
cur_mask = row_mask;