diff options
| author | Tobias Naumann <[email protected]> | 2025-03-31 16:48:13 +0200 |
|---|---|---|
| committer | Tobias Naumann <[email protected]> | 2025-03-31 16:48:13 +0200 |
| commit | c29fc3532b34633b2234c26a7e41e8ba6d628e7f (patch) | |
| tree | 667bc74b504a65592c805fd3f66197bd2126801f /embassy-executor-macros | |
| parent | 14d079ae84ac28ce860015ad6ca8d040edf3f065 (diff) | |
| parent | 4d9b41714da77d82811f39bd6feabe161e93552c (diff) | |
Merge branch 'main' into fix/ringbuffered-error-handling to resolve merge conflicts
Diffstat (limited to 'embassy-executor-macros')
| -rw-r--r-- | embassy-executor-macros/src/macros/task.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/embassy-executor-macros/src/macros/task.rs b/embassy-executor-macros/src/macros/task.rs index e8134c6a9..91d6beee8 100644 --- a/embassy-executor-macros/src/macros/task.rs +++ b/embassy-executor-macros/src/macros/task.rs | |||
| @@ -145,9 +145,20 @@ pub fn run(args: TokenStream, item: TokenStream) -> TokenStream { | |||
| 145 | }; | 145 | }; |
| 146 | #[cfg(not(feature = "nightly"))] | 146 | #[cfg(not(feature = "nightly"))] |
| 147 | let mut task_outer_body = quote! { | 147 | let mut task_outer_body = quote! { |
| 148 | const fn __task_pool_get<F, Args, Fut>(_: F) -> &'static #embassy_executor::raw::TaskPool<Fut, POOL_SIZE> | ||
| 149 | where | ||
| 150 | F: #embassy_executor::_export::TaskFn<Args, Fut = Fut>, | ||
| 151 | Fut: ::core::future::Future + 'static, | ||
| 152 | { | ||
| 153 | unsafe { &*POOL.get().cast() } | ||
| 154 | } | ||
| 155 | |||
| 148 | const POOL_SIZE: usize = #pool_size; | 156 | const POOL_SIZE: usize = #pool_size; |
| 149 | static POOL: #embassy_executor::_export::TaskPoolRef = #embassy_executor::_export::TaskPoolRef::new(); | 157 | static POOL: #embassy_executor::_export::TaskPoolHolder< |
| 150 | unsafe { POOL.get::<_, POOL_SIZE>()._spawn_async_fn(move || #task_inner_ident(#(#full_args,)*)) } | 158 | {#embassy_executor::_export::task_pool_size::<_, _, _, POOL_SIZE>(#task_inner_ident)}, |
| 159 | {#embassy_executor::_export::task_pool_align::<_, _, _, POOL_SIZE>(#task_inner_ident)}, | ||
| 160 | > = unsafe { ::core::mem::transmute(#embassy_executor::_export::task_pool_new::<_, _, _, POOL_SIZE>(#task_inner_ident)) }; | ||
| 161 | unsafe { __task_pool_get(#task_inner_ident)._spawn_async_fn(move || #task_inner_ident(#(#full_args,)*)) } | ||
| 151 | }; | 162 | }; |
| 152 | 163 | ||
| 153 | let task_outer_attrs = task_inner.attrs.clone(); | 164 | let task_outer_attrs = task_inner.attrs.clone(); |
