Async tasks can now take arguments at spawn again

This commit is contained in:
Emil Fresk 2023-01-10 21:03:10 +01:00 committed by Henrik Tjäder
parent cd790a9428
commit d6d58b0eb8
17 changed files with 153 additions and 80 deletions

View file

@ -27,6 +27,7 @@ mod app {
hprintln!("init");
async_task::spawn().unwrap();
async_task_args::spawn(1, 2).unwrap();
async_task2::spawn().unwrap();
(Shared { a: 0 }, Local {})
@ -53,6 +54,11 @@ mod app {
hprintln!("hello from async");
}
#[task]
async fn async_task_args(_cx: async_task_args::Context, a: u32, b: i32) {
hprintln!("hello from async with args a: {}, b: {}", a, b);
}
#[task(priority = 2, shared = [a])]
async fn async_task2(cx: async_task2::Context) {
let async_task2::SharedResources { a: _, .. } = cx.shared;