mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
sync: forward port 0.2 mpsc test (#3225)
Forward ports the test included in #3215. The mpsc sempahore has been replaced in 0.3 and does not include the bug being fixed.
This commit is contained in:
parent
0707f4c192
commit
62023dffe5
@ -483,3 +483,22 @@ async fn ready_close_cancel_bounded() {
|
||||
let val = assert_ready!(recv.poll());
|
||||
assert!(val.is_none());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn permit_available_not_acquired_close() {
|
||||
let (tx1, mut rx) = mpsc::channel::<()>(1);
|
||||
let tx2 = tx1.clone();
|
||||
|
||||
let permit1 = assert_ok!(tx1.reserve().await);
|
||||
|
||||
let mut permit2 = task::spawn(tx2.reserve());
|
||||
assert_pending!(permit2.poll());
|
||||
|
||||
rx.close();
|
||||
|
||||
drop(permit1);
|
||||
assert!(permit2.is_woken());
|
||||
|
||||
drop(permit2);
|
||||
assert!(rx.recv().await.is_none());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user