Skip to content

Commit

Permalink
Merge pull request #1140 from wang384670111/tune_ordering
Browse files Browse the repository at this point in the history
Potential to modify ordering for split_count and tour_counter
  • Loading branch information
cuviper authored Mar 5, 2024
2 parents 990841b + 11bc58a commit bb24895
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rayon-demo/src/tsp/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<'s> SolverCx<'s> {
}

pub fn tour_id(&self) -> TourId {
let counter = self.tour_counter.fetch_add(1, Ordering::SeqCst);
let counter = self.tour_counter.fetch_add(1, Ordering::Relaxed);
TourId { id: counter }
}

Expand Down
2 changes: 1 addition & 1 deletion src/iter/par_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<Iter: Iterator + Send> UnindexedProducer for &IterParallelProducer<'_, Iter
// Check if the iterator is exhausted
let update = self
.split_count
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |c| c.checked_sub(1));
.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |c| c.checked_sub(1));
(self, update.is_ok().then_some(self))
}

Expand Down

0 comments on commit bb24895

Please sign in to comment.