summaryrefslogtreecommitdiffstats
path: root/tokio/src/sync/tests/loom_watch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/src/sync/tests/loom_watch.rs')
-rw-r--r--tokio/src/sync/tests/loom_watch.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tokio/src/sync/tests/loom_watch.rs b/tokio/src/sync/tests/loom_watch.rs
new file mode 100644
index 00000000..7944cab8
--- /dev/null
+++ b/tokio/src/sync/tests/loom_watch.rs
@@ -0,0 +1,20 @@
+use crate::sync::watch;
+
+use loom::future::block_on;
+use loom::thread;
+
+#[test]
+fn smoke() {
+ loom::model(|| {
+ let (tx, mut rx) = watch::channel(1);
+
+ let th = thread::spawn(move || {
+ tx.send(2).unwrap();
+ });
+
+ block_on(rx.changed()).unwrap();
+ assert_eq!(*rx.borrow(), 2);
+
+ th.join().unwrap();
+ })
+}