mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 07:29:23 +00:00
Skip the CAS on new_pos < 0 (#1080)
This commit is contained in:
parent
fd75fd1467
commit
6715b670b1
1 changed files with 3 additions and 3 deletions
|
@ -66,8 +66,8 @@ Restart:
|
|||
default:
|
||||
new_pos = einval();
|
||||
}
|
||||
} while (!LIKELY(atomic_compare_exchange_weak_explicit(
|
||||
&h->pos, &pos, new_pos < 0 ? pos : new_pos, memory_order_release,
|
||||
memory_order_relaxed)));
|
||||
} while (new_pos >= 0 && !LIKELY(atomic_compare_exchange_weak_explicit(
|
||||
&h->pos, &pos, new_pos, memory_order_release,
|
||||
memory_order_relaxed)));
|
||||
return new_pos;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue