fix :error

This commit is contained in:
tqcq 2024-10-26 13:15:55 +00:00
parent 8a74c8e78f
commit c7246f9740

View File

@ -340,22 +340,23 @@ find_row_mask(std::vector<set_t> &sets,
// step /= thread_num;
// if (!step) { ++step; }
fprintf(stderr, "worker_step: %ld\n", outer_step);
auto try_update_row_mask = [&](uint64_t pos, uint64_t mask) {
if (pos > g_base_pos.load(std::memory_order_relaxed)) {
auto try_update_row_mask = [&](uint64_t cur_pos, uint64_t cur_mask) {
if (cur_pos > g_base_pos.load(std::memory_order_relaxed)) {
std::lock_guard<std::mutex> _(lock);
if (pos > g_base_pos.load()) {
g_base_pos = row_mask;
row_mask = mask;
if (cur_pos > g_base_pos.load()) {
g_base_pos = cur_pos;
row_mask = cur_mask;
}
}
};
auto try_get_row_mask = [&](uint64_t end_pos, uint64_t &diff, uint64_t &cur_mask) {
uint64_t v = g_base_pos.load(std::memory_order_relaxed);
if (end_pos - diff < v && end_pos >= v) {
uint64_t v = g_base_pos.load(std::memory_order_relaxed);
uint64_t cur_pos = end_pos - diff;
if (cur_pos < v && end_pos >= v) {
std::lock_guard<std::mutex> _(lock);
v = g_base_pos.load();
if (end_pos - diff < v && end_pos >= v) {
diff = end_pos - v;
if (cur_pos < v && end_pos >= v) {
diff = end_pos - g_base_pos.load();
cur_mask = row_mask;
}
}