From 60e45f096d4a33ba6169cf9a0730d5bccca3264b Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 16 Apr 2020 20:42:21 +0200 Subject: [PATCH] libasync: Sockets::run() returns ! --- experiments/src/main.rs | 2 +- libasync/src/smoltcp/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/experiments/src/main.rs b/experiments/src/main.rs index e760054..92ab8cf 100644 --- a/experiments/src/main.rs +++ b/experiments/src/main.rs @@ -261,7 +261,7 @@ pub fn main_core0() { Sockets::run(&mut iface, || { time += 1; Instant::from_millis(time) - }); + }) } static CORE1_REQ: Mutex>> = Mutex::new(None); diff --git a/libasync/src/smoltcp/mod.rs b/libasync/src/smoltcp/mod.rs index b54fb30..fd5191e 100644 --- a/libasync/src/smoltcp/mod.rs +++ b/libasync/src/smoltcp/mod.rs @@ -44,14 +44,14 @@ impl Sockets { pub fn run<'b, 'c, 'e, D: for<'d> Device<'d>>( iface: &mut EthernetInterface<'b, 'c, 'e, D>, mut get_time: impl FnMut() -> Instant, - ) { + ) -> ! { task::block_on(async { loop { let instant = get_time(); Self::instance().poll(iface, instant); task::r#yield().await; } - }); + }) } pub(crate) fn instance() -> &'static Self {