Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
vDorst committed Oct 23, 2024
1 parent 4d431f2 commit df9e662
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions embassy-executor/src/arch/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
mutex: Mutex<bool>,
condvar: Condvar,
}

impl Signaler {
/// Create a new Signaler.
pub fn new() -> Self {
Self {
mutex: Mutex::new(false),
Expand Down

0 comments on commit df9e662

Please sign in to comment.