As of now it doesn't seem possible to get a pointer to the current executor from a sync context in Embassy. For example:
async fn foo(){
bar();
}
fn bar()
{
let p: *const raw::Executor = embassy_executor::get_current_executor_raw_ptr();
// do stuff with the executor
let ringbuf = RINGBUFS.get(executor); // from a hashmap for example
}
Is it possible to add this kind of functionality to Embassy? I have a bit of a proof of concept here, specific to the rp2040, that seems to work but is highly tailored to my use case (lock-free logging using defmt with only very brief disabling of interrupts). What I've done is basically store the current executor in a static, one for each core, and I have macros to ensure that this always gets saved and restored correctly (I think) based on which interrupt is currently executing. It seems to work, but is very kludgy. This relies on interrupts of the same priority not interrupting other interrupts of the same priority, which (correct me if I'm wrong) seems to be the case on this chip.
As of now it doesn't seem possible to get a pointer to the current executor from a sync context in Embassy. For example:
Is it possible to add this kind of functionality to Embassy? I have a bit of a proof of concept here, specific to the rp2040, that seems to work but is highly tailored to my use case (lock-free logging using
defmt
with only very brief disabling of interrupts). What I've done is basically store the current executor in a static, one for each core, and I have macros to ensure that this always gets saved and restored correctly (I think) based on which interrupt is currently executing. It seems to work, but is very kludgy. This relies on interrupts of the same priority not interrupting other interrupts of the same priority, which (correct me if I'm wrong) seems to be the case on this chip.Thanks!