aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/raw
diff options
context:
space:
mode:
authorDániel Buga <[email protected]>2023-08-14 15:16:40 +0200
committerDániel Buga <[email protected]>2023-08-14 15:16:40 +0200
commit4c4b12c307bf77516299eb73f9da00ef777b9814 (patch)
treed10f1c9dc44d60ead7245c988220da268cdd7746 /embassy-executor/src/raw
parentf6007869bffd3ed4f48e74222dc40d11c7c87ec0 (diff)
Make PenderContext opaque
Diffstat (limited to 'embassy-executor/src/raw')
-rw-r--r--embassy-executor/src/raw/mod.rs23
1 files changed, 21 insertions, 2 deletions
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs
index a0a940e25..4a6e45535 100644
--- a/embassy-executor/src/raw/mod.rs
+++ b/embassy-executor/src/raw/mod.rs
@@ -292,10 +292,29 @@ impl<F: Future + 'static, const N: usize> TaskPool<F, N> {
292} 292}
293 293
294/// Context given to the thread-mode executor's pender. 294/// Context given to the thread-mode executor's pender.
295pub type PenderContext = usize; 295#[repr(transparent)]
296#[derive(Clone, Copy)]
297pub struct PenderContext(usize);
296 298
299/// Platform/architecture-specific action executed when an executor has pending work.
300///
301/// When a task within an executor is woken, the `Pender` is called. This does a
302/// platform/architecture-specific action to signal there is pending work in the executor.
303/// When this happens, you must arrange for [`Executor::poll`] to be called.
304///
305/// You can think of it as a waker, but for the whole executor.
306///
307/// Platform/architecture implementations must provide a function that can be referred to as:
308///
309/// ```rust
310/// use embassy_executor::raw::PenderContext;
311///
312/// extern "Rust" {
313/// fn __pender(context: PenderContext);
314/// }
315/// ```
297#[derive(Clone, Copy)] 316#[derive(Clone, Copy)]
298pub(crate) struct Pender(PenderContext); 317pub struct Pender(PenderContext);
299 318
300unsafe impl Send for Pender {} 319unsafe impl Send for Pender {}
301unsafe impl Sync for Pender {} 320unsafe impl Sync for Pender {}