hits.fetch_add(1, SeqCst);
}
- while let Some(_) = w2.pop() {
+ while w2.pop().is_some() {
hits.fetch_add(1, SeqCst);
}
}
let mut rng = rand::thread_rng();
let mut expected = 0;
while expected < COUNT {
- if rng.gen_range(0, 3) == 0 {
- while let Some(_) = w.pop() {
+ if rng.gen_range(0..3) == 0 {
+ while w.pop().is_some() {
hits.fetch_add(1, SeqCst);
}
} else {
}
while hits.load(SeqCst) < COUNT {
- while let Some(_) = w.pop() {
+ while w.pop().is_some() {
hits.fetch_add(1, SeqCst);
}
}
hits.fetch_add(1, SeqCst);
}
- while let Some(_) = w2.pop() {
+ while w2.pop().is_some() {
hits.fetch_add(1, SeqCst);
}
}
let mut rng = rand::thread_rng();
let mut my_hits = 0;
loop {
- for i in 0..rng.gen_range(0, COUNT) {
- if rng.gen_range(0, 3) == 0 && my_hits == 0 {
- while let Some(_) = w.pop() {
+ for i in 0..rng.gen_range(0..COUNT) {
+ if rng.gen_range(0..3) == 0 && my_hits == 0 {
+ while w.pop().is_some() {
my_hits += 1;
}
} else {
remaining.fetch_sub(1, SeqCst);
}
- while let Some(_) = w2.pop() {
+ while w2.pop().is_some() {
cnt += 1;
remaining.fetch_sub(1, SeqCst);
}
}
for _ in 0..STEPS {
- if let Some(_) = w.pop() {
+ if w.pop().is_some() {
remaining.fetch_sub(1, SeqCst);
}
}