Skip to content

Commit

Permalink
fix poll-after-completion test
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Giersch committed May 3, 2023
1 parent 8e72e87 commit 3267823
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/semaphore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,12 +796,14 @@ mod tests {

core::future::poll_fn(|cx| {
assert!(fut.as_mut().poll(cx).is_ready());
assert!(fut.as_mut().poll(cx).is_pending());
// polling again after completion, works in this case, but might
// cause a Waker leak under other circumstances.
assert!(fut.as_mut().poll(cx).is_ready());
Poll::Ready(())
})
.await;

assert_eq!(sem.available_permits(), 1);
assert_eq!(sem.available_permits(), 0);
});
}

Expand Down

0 comments on commit 3267823

Please sign in to comment.