Add spawn/spawn_pool APIs to Task

This commit is contained in:
Dario Nieuwenhuis
2021-03-18 00:38:27 +01:00
parent 5c2bf3981e
commit 8c2da193b8
5 changed files with 36 additions and 24 deletions

View File

@ -105,7 +105,7 @@ pub fn task(args: TokenStream, item: TokenStream) -> TokenStream {
type F = #impl_ty;
const NEW_TASK: Task<F> = Task::new();
static POOL: [Task<F>; #pool_size] = [NEW_TASK; #pool_size];
unsafe { Task::spawn(&POOL, move || task(#arg_names)) }
unsafe { Task::spawn_pool(&POOL, move || task(#arg_names)) }
}
};
result.into()