Commit 0bddf3d 1 parent f0d7a31 commit 0bddf3d Copy full SHA for 0bddf3d
File tree 2 files changed +7
-12
lines changed
examples/xbd-net/src/embassy
2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,11 @@ impl Executor {
32
32
pub fn run ( & ' static mut self , init : impl FnOnce ( Spawner ) ) -> ! {
33
33
init ( self . executor . spawner ( ) ) ;
34
34
35
+ let throttle = 100 ;
36
+ crate :: println!( "@@ Executor::run(): throttle: {} ms" , throttle) ;
37
+
35
38
loop {
39
+ crate :: Xbd :: msleep ( throttle, false ) ;
36
40
unsafe { self . executor . poll ( ) } ;
37
41
}
38
42
}
Original file line number Diff line number Diff line change 1
- use super :: xbd:: { self , Xbd } ;
1
+ use super :: xbd;
2
2
3
3
mod executor;
4
4
use executor:: Executor ;
5
5
6
6
#[ embassy_executor:: task]
7
- async fn task_xbd_main ( throttle : u32 ) {
7
+ async fn task_xbd_main ( ) {
8
8
super :: xbd_main ( ) . await . unwrap ( ) ;
9
-
10
- //loop { Xbd::async_sleep(1000).await; } // yield -> executor busy
11
- //====
12
- //loop { Xbd::msleep(1000, true); } // not yield (debug for internal async API calls only) -> executor not busy
13
- //==== kludge
14
- loop { Xbd :: async_sleep ( 1 ) . await ; Xbd :: msleep ( throttle, false ) ; } // yield && less busy
15
9
}
16
10
17
11
#[ embassy_executor:: task]
@@ -47,11 +41,8 @@ impl Runtime {
47
41
}
48
42
49
43
pub fn run ( & ' static mut self ) -> ! {
50
- let throttle = 200 ;
51
- crate :: println!( "@@ task_xbd_main(): throttle: {} ms" , throttle) ;
52
-
53
44
self . 0 . run ( |spawner| {
54
- spawner. spawn ( task_xbd_main ( throttle ) ) . unwrap ( ) ;
45
+ spawner. spawn ( task_xbd_main ( ) ) . unwrap ( ) ;
55
46
spawner. spawn ( task_shell_stream ( ) ) . unwrap ( ) ;
56
47
spawner. spawn ( task_gcoap_server_stream ( ) ) . unwrap ( ) ;
57
48
spawner. spawn ( task_api_stream ( ) ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments