From 917c0c5e2d0d52b45ffcbc368cc1f6425872ffed Mon Sep 17 00:00:00 2001 From: Tim Kuehn Date: Sat, 7 Dec 2019 21:28:45 -0800 Subject: [PATCH] Use tokio::time::delay_for in lieu of thread::sleep. --- tarpc/examples/pubsub.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tarpc/examples/pubsub.rs b/tarpc/examples/pubsub.rs index 8546a1a..f20e164 100644 --- a/tarpc/examples/pubsub.rs +++ b/tarpc/examples/pubsub.rs @@ -16,7 +16,6 @@ use std::{ net::SocketAddr, pin::Pin, sync::{Arc, Mutex}, - thread, time::Duration, }; use subscriber::Subscriber as _; @@ -188,7 +187,8 @@ async fn main() -> io::Result<()> { .broadcast(context::current(), "hi again".to_string()) .await?; - thread::sleep(Duration::from_millis(100)); + tokio::time::delay_for(Duration::from_millis(100)).await; + println!("Done."); Ok(()) }