You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::{
sync::atomic::Ordering,
time::{Duration,Instant},};#[test]fntest(){let last_time = atomic::Atomic::new(Instant::now());letmut count = 0;loop{let update = last_time.fetch_update(Ordering::SeqCst,Ordering::SeqCst, |old| {let now = std::time::Instant::now();(now.duration_since(old) >= Duration::from_millis(1)).then_some(now)});if update.is_ok(){println!("update: {update:?}");// comment this line to see the difference
count += 1;if count > 1{break;}}}}
It seems that accessing update will make the following compare_exchange_weak always failing. Please correct me if it's not a bug.
system: Darwin MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:19 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8103 arm64
cargo: cargo 1.73.0-nightly (7ac9416d8 2023-07-24)
The text was updated successfully, but these errors were encountered:
MRE:
It seems that accessing
update
will make the followingcompare_exchange_weak
always failing. Please correct me if it's not a bug.system:
Darwin MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:19 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8103 arm64
cargo:
cargo 1.73.0-nightly (7ac9416d8 2023-07-24)
The text was updated successfully, but these errors were encountered: