diff options
author | Sunil Nimmagadda <sunil@nimmagadda.net> | 2022-11-28 15:42:07 +0530 |
---|---|---|
committer | Sunil Nimmagadda <sunil@nimmagadda.net> | 2022-11-28 15:42:07 +0530 |
commit | a8163f083ee945c426014e0bd0025578cf418146 (patch) | |
tree | e28a2a706aca510923c69e850f8c8be1554c9d36 /src/bin/main.rs | |
parent | d14ee66f4157256dc65e95be0f8e25f90c74dea8 (diff) |
Backed out changeset 50156c8f38b0
Diffstat (limited to 'src/bin/main.rs')
-rw-r--r-- | src/bin/main.rs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs deleted file mode 100644 index 7d31e24..0000000 --- a/src/bin/main.rs +++ /dev/null @@ -1,43 +0,0 @@ -use tokio::signal::unix::{signal, SignalKind}; -use tokio::time; - -const ADV_INTERVAL: u64 = 3; -const SKEW_INTERVAL: u64 = 1; - -async fn advert_handler() { - println!("3 second timer fired"); -} - -async fn skew_handler() { - println!("1 second timer fired"); -} - -async fn sighup_handler() { - println!("got SIGHUP"); -} - -#[tokio::main(flavor = "current_thread")] -async fn main() { - let advert_handle = tokio::spawn(async move { - let mut advert_interval = time::interval(time::Duration::from_secs(ADV_INTERVAL)); - loop { - advert_interval.tick().await; - advert_handler().await; - } - }); - let skew_handle = tokio::spawn(async move { - let mut skew_interval = time::interval(time::Duration::from_secs(SKEW_INTERVAL)); - loop { - skew_interval.tick().await; - skew_handler().await; - } - }); - let sighup_handle = tokio::spawn(async move { - let mut stream = signal(SignalKind::hangup()).expect("Should be a signal stream"); - loop { - stream.recv().await; - sighup_handler().await; - } - }); - let (_, _, _) = tokio::join!(advert_handle, skew_handle, sighup_handle); -} |