We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
let pool = Pool::bounded(3); let counter = Arc::new(AtomicUsize::new(0)); for _ in 1..=5 { let counter_c = counter.clone(); pool.spawn(async move { sleep(Duration::from_secs(3)).await; counter_c.fetch_add(1, Ordering::SeqCst); }) .await .unwrap(); } sleep(Duration::from_secs(3)).await; // println!("{}",counter.load(Ordering::SeqCst)); assert_eq!(counter.load(Ordering::SeqCst), 5);
The text was updated successfully, but these errors were encountered:
Good day,
I tested the example, the behaviour looks fine. Could you please explain where the problem is?
Sorry, something went wrong.
No branches or pull requests
let pool = Pool::bounded(3);
let counter = Arc::new(AtomicUsize::new(0));
for _ in 1..=5 {
let counter_c = counter.clone();
pool.spawn(async move {
sleep(Duration::from_secs(3)).await;
counter_c.fetch_add(1, Ordering::SeqCst);
})
.await
.unwrap();
}
sleep(Duration::from_secs(3)).await;
// println!("{}",counter.load(Ordering::SeqCst));
assert_eq!(counter.load(Ordering::SeqCst), 5);
The text was updated successfully, but these errors were encountered: