mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 08:12:30 +00:00
Add documentation
This commit is contained in:
parent
4d431f2d66
commit
df9e662b50
@ -64,12 +64,26 @@ mod thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `Signaler` is used in `__pender()`;
|
||||||
|
///
|
||||||
|
/// This is only needed when creating a [`raw::Executor`].
|
||||||
|
///
|
||||||
|
/// # Example
|
||||||
|
/// ```rust
|
||||||
|
/// let signaler = Box::leak(Box::new(Signaler::new()));
|
||||||
|
/// let executor = &*Box::leak(Box::new(Executor::new(signaler)));
|
||||||
|
///
|
||||||
|
/// executor.spawner().spawn(/* EmbassyTask(Arguments) */).unwrap();
|
||||||
|
///
|
||||||
|
/// unsafe { executor.poll() };
|
||||||
|
/// ```
|
||||||
pub struct Signaler {
|
pub struct Signaler {
|
||||||
mutex: Mutex<bool>,
|
mutex: Mutex<bool>,
|
||||||
condvar: Condvar,
|
condvar: Condvar,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Signaler {
|
impl Signaler {
|
||||||
|
/// Create a new Signaler.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
mutex: Mutex::new(false),
|
mutex: Mutex::new(false),
|
||||||
|
Loading…
Reference in New Issue
Block a user