aboutsummaryrefslogtreecommitdiff
path: root/src/sync/tests/loom_oneshot.rs
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2021-11-16 11:16:30 +0100
committerJeff Vander Stoep <jeffv@google.com>2021-11-16 11:17:30 +0100
commit1db412d2c35d13b9d4b8ab28ca56de5b77abff71 (patch)
treea86a1094890ceb522b599e1f37f24c2e16239fd3 /src/sync/tests/loom_oneshot.rs
parente16ac718df3b8af3bef9bc0c1b6c9bfb5f8e71e1 (diff)
downloadtokio-1db412d2c35d13b9d4b8ab28ca56de5b77abff71.tar.gz
Update to 1.14.0
Test: atest Change-Id: I713529f5ba957c212f50bde27b4428612dbcdefd
Diffstat (limited to 'src/sync/tests/loom_oneshot.rs')
-rw-r--r--src/sync/tests/loom_oneshot.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/sync/tests/loom_oneshot.rs b/src/sync/tests/loom_oneshot.rs
index 9729cfb..c5f7972 100644
--- a/src/sync/tests/loom_oneshot.rs
+++ b/src/sync/tests/loom_oneshot.rs
@@ -55,6 +55,35 @@ fn changing_rx_task() {
});
}
+#[test]
+fn try_recv_close() {
+ // reproduces https://github.com/tokio-rs/tokio/issues/4225
+ loom::model(|| {
+ let (tx, mut rx) = oneshot::channel();
+ thread::spawn(move || {
+ let _ = tx.send(());
+ });
+
+ rx.close();
+ let _ = rx.try_recv();
+ })
+}
+
+#[test]
+fn recv_closed() {
+ // reproduces https://github.com/tokio-rs/tokio/issues/4225
+ loom::model(|| {
+ let (tx, mut rx) = oneshot::channel();
+
+ thread::spawn(move || {
+ let _ = tx.send(1);
+ });
+
+ rx.close();
+ let _ = block_on(rx);
+ });
+}
+
// TODO: Move this into `oneshot` proper.
use std::future::Future;