refactor(users/edef/weave): use swap rather than CAS
We only care about ordering on the same variable, and we rely on the release barrier provided by rayon's thread joining. The comparison failing is always an error path, and we're indifferent about which thread it fails on. Change-Id: I592a7eaae5b6935cf424c6576a49786f39909fb6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12666 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
parent
25671c284f
commit
549c51f200
1 changed files with 5 additions and 3 deletions
|
@ -43,9 +43,11 @@ fn main() -> Result<()> {
|
|||
eprint!("… resolve roots\r");
|
||||
ph_array.par_iter().enumerate().for_each(|(idx, h)| {
|
||||
if let Some(idx_slot) = roots.find(h) {
|
||||
idx_slot
|
||||
.compare_exchange(INDEX_NULL, idx as u32, Ordering::SeqCst, Ordering::SeqCst)
|
||||
.expect("duplicate entry");
|
||||
assert_eq!(
|
||||
idx_slot.swap(idx as u32, Ordering::Relaxed),
|
||||
INDEX_NULL,
|
||||
"duplicate entry"
|
||||
);
|
||||
}
|
||||
});
|
||||
eprintln!("{DONE}");
|
||||
|
|
Loading…
Reference in a new issue