mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-30 05:40:39 +00:00
embassy: introduce InterruptExecutor::spawner()
(#1211)
Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
This commit is contained in:
parent
e81957ee98
commit
3ec0f3b8ba
@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Added basic `LP-I2C` driver for C6 (#1185)
|
||||
- Ensuring that the random number generator is TRNG. (#1200)
|
||||
- ESP32-C6: Add timer wakeup source for deepsleep (#1201)
|
||||
- Introduce `InterruptExecutor::spawner()` (#1211)
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -175,4 +175,19 @@ where
|
||||
let executor = unsafe { (*self.executor.get()).assume_init_ref() };
|
||||
executor.spawner().make_send()
|
||||
}
|
||||
|
||||
/// Get a SendSpawner for this executor
|
||||
///
|
||||
/// This returns a [`SendSpawner`] you can use to spawn tasks on this
|
||||
/// executor.
|
||||
///
|
||||
/// This MUST only be called on an executor that has already been started.
|
||||
/// The function will panic otherwise.
|
||||
pub fn spawner(&'static self) -> SendSpawner {
|
||||
if self.core.load(Ordering::Acquire) == usize::MAX {
|
||||
panic!("InterruptExecutor::spawner() called on uninitialized executor.");
|
||||
}
|
||||
let executor = unsafe { (&*self.executor.get()).assume_init_ref() };
|
||||
executor.spawner().make_send()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user