fix: check if new_ptr == end, not the old pointer

This commit is contained in:
Liam Murphy 2021-06-30 16:04:34 +10:00
parent 53b95588df
commit 99339e940e

View File

@ -107,10 +107,10 @@ impl<'d> Rng<'d> {
.ptr
.compare_exchange(ptr, new_ptr, Ordering::Relaxed, Ordering::Relaxed)
{
Ok(ptr) => {
Ok(_) => {
let end = STATE.end.load(Ordering::Relaxed);
// It doesn't matter if `end` was changed under our feet, because then this will just be false.
if ptr == end {
if new_ptr == end {
STATE.waker.wake();
}
}