Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Use fetch_min instead #327

Open
recmo opened this issue Sep 24, 2019 · 0 comments
Open

Use fetch_min instead #327

recmo opened this issue Sep 24, 2019 · 0 comments
Assignees
Labels
refactor Improves the code quality tracker Issues generated from source comments

Comments

@recmo
Copy link
Contributor

recmo commented Sep 24, 2019

On 2019-09-24 @recmo wrote in 7204c21 “Stable lock-free threaded pow”:

Use fetch_min instead
See https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#method.fetch_max
This is pending rust-lang/rust#48655

    pub(crate) fn nonce(self) -> u64 {
        self.nonce
    }
}

// TODO: Use `fetch_min` instead
// See https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#method.fetch_max
// This is pending https://github.com/rust-lang/rust/issues/48655
#[cfg(all(feature = "std", feature = "prover"))]
fn fetch_min(atom: &AtomicU64, value: u64) -> u64 {
    let mut prev = atom.load(Relaxed);
    while prev > value {
        match atom.compare_exchange_weak(prev, value, Relaxed, Relaxed) {

From crypto/openstark/src/proof_of_work.rs:110

@recmo recmo added refactor Improves the code quality tracker Issues generated from source comments labels Sep 24, 2019
@recmo recmo self-assigned this Sep 24, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
refactor Improves the code quality tracker Issues generated from source comments
Projects
None yet
Development

No branches or pull requests

1 participant