diff options
Diffstat (limited to 'embassy-executor/src')
| -rw-r--r-- | embassy-executor/src/arch/avr.rs | 2 | ||||
| -rw-r--r-- | embassy-executor/src/arch/cortex_ar.rs | 2 | ||||
| -rw-r--r-- | embassy-executor/src/arch/cortex_m.rs | 2 | ||||
| -rw-r--r-- | embassy-executor/src/arch/riscv32.rs | 2 | ||||
| -rw-r--r-- | embassy-executor/src/arch/spin.rs | 2 | ||||
| -rw-r--r-- | embassy-executor/src/arch/std.rs | 2 | ||||
| -rw-r--r-- | embassy-executor/src/arch/wasm.rs | 2 | ||||
| -rw-r--r-- | embassy-executor/src/lib.rs | 1 | ||||
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 6 | ||||
| -rw-r--r-- | embassy-executor/src/raw/waker_turbo.rs | 2 |
10 files changed, 12 insertions, 11 deletions
diff --git a/embassy-executor/src/arch/avr.rs b/embassy-executor/src/arch/avr.rs index 70085d04d..4a19c523a 100644 --- a/embassy-executor/src/arch/avr.rs +++ b/embassy-executor/src/arch/avr.rs | |||
| @@ -14,7 +14,7 @@ mod thread { | |||
| 14 | 14 | ||
| 15 | static SIGNAL_WORK_THREAD_MODE: AtomicBool = AtomicBool::new(false); | 15 | static SIGNAL_WORK_THREAD_MODE: AtomicBool = AtomicBool::new(false); |
| 16 | 16 | ||
| 17 | #[export_name = "__pender"] | 17 | #[unsafe(export_name = "__pender")] |
| 18 | fn __pender(_context: *mut ()) { | 18 | fn __pender(_context: *mut ()) { |
| 19 | SIGNAL_WORK_THREAD_MODE.store(true, Ordering::SeqCst); | 19 | SIGNAL_WORK_THREAD_MODE.store(true, Ordering::SeqCst); |
| 20 | } | 20 | } |
diff --git a/embassy-executor/src/arch/cortex_ar.rs b/embassy-executor/src/arch/cortex_ar.rs index f9e2f3f7c..36d45944a 100644 --- a/embassy-executor/src/arch/cortex_ar.rs +++ b/embassy-executor/src/arch/cortex_ar.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #[cfg(feature = "executor-interrupt")] | 1 | #[cfg(feature = "executor-interrupt")] |
| 2 | compile_error!("`executor-interrupt` is not supported with `arch-cortex-ar`."); | 2 | compile_error!("`executor-interrupt` is not supported with `arch-cortex-ar`."); |
| 3 | 3 | ||
| 4 | #[export_name = "__pender"] | 4 | #[unsafe(export_name = "__pender")] |
| 5 | #[cfg(any(feature = "executor-thread", feature = "executor-interrupt"))] | 5 | #[cfg(any(feature = "executor-thread", feature = "executor-interrupt"))] |
| 6 | fn __pender(context: *mut ()) { | 6 | fn __pender(context: *mut ()) { |
| 7 | // `context` is always `usize::MAX` created by `Executor::run`. | 7 | // `context` is always `usize::MAX` created by `Executor::run`. |
diff --git a/embassy-executor/src/arch/cortex_m.rs b/embassy-executor/src/arch/cortex_m.rs index 1c9ddd8a0..9f1081e93 100644 --- a/embassy-executor/src/arch/cortex_m.rs +++ b/embassy-executor/src/arch/cortex_m.rs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #[export_name = "__pender"] | 1 | #[unsafe(export_name = "__pender")] |
| 2 | #[cfg(any(feature = "executor-thread", feature = "executor-interrupt"))] | 2 | #[cfg(any(feature = "executor-thread", feature = "executor-interrupt"))] |
| 3 | fn __pender(context: *mut ()) { | 3 | fn __pender(context: *mut ()) { |
| 4 | unsafe { | 4 | unsafe { |
diff --git a/embassy-executor/src/arch/riscv32.rs b/embassy-executor/src/arch/riscv32.rs index 01e63a9fd..13b93cf02 100644 --- a/embassy-executor/src/arch/riscv32.rs +++ b/embassy-executor/src/arch/riscv32.rs | |||
| @@ -15,7 +15,7 @@ mod thread { | |||
| 15 | /// global atomic used to keep track of whether there is work to do since sev() is not available on RISCV | 15 | /// global atomic used to keep track of whether there is work to do since sev() is not available on RISCV |
| 16 | static SIGNAL_WORK_THREAD_MODE: AtomicBool = AtomicBool::new(false); | 16 | static SIGNAL_WORK_THREAD_MODE: AtomicBool = AtomicBool::new(false); |
| 17 | 17 | ||
| 18 | #[export_name = "__pender"] | 18 | #[unsafe(export_name = "__pender")] |
| 19 | fn __pender(_context: *mut ()) { | 19 | fn __pender(_context: *mut ()) { |
| 20 | SIGNAL_WORK_THREAD_MODE.store(true, Ordering::SeqCst); | 20 | SIGNAL_WORK_THREAD_MODE.store(true, Ordering::SeqCst); |
| 21 | } | 21 | } |
diff --git a/embassy-executor/src/arch/spin.rs b/embassy-executor/src/arch/spin.rs index 340023620..40cb56a09 100644 --- a/embassy-executor/src/arch/spin.rs +++ b/embassy-executor/src/arch/spin.rs | |||
| @@ -11,7 +11,7 @@ mod thread { | |||
| 11 | 11 | ||
| 12 | use crate::{raw, Spawner}; | 12 | use crate::{raw, Spawner}; |
| 13 | 13 | ||
| 14 | #[export_name = "__pender"] | 14 | #[unsafe(export_name = "__pender")] |
| 15 | fn __pender(_context: *mut ()) {} | 15 | fn __pender(_context: *mut ()) {} |
| 16 | 16 | ||
| 17 | /// Spin Executor | 17 | /// Spin Executor |
diff --git a/embassy-executor/src/arch/std.rs b/embassy-executor/src/arch/std.rs index b02b15988..cdb9f7642 100644 --- a/embassy-executor/src/arch/std.rs +++ b/embassy-executor/src/arch/std.rs | |||
| @@ -12,7 +12,7 @@ mod thread { | |||
| 12 | 12 | ||
| 13 | use crate::{raw, Spawner}; | 13 | use crate::{raw, Spawner}; |
| 14 | 14 | ||
| 15 | #[export_name = "__pender"] | 15 | #[unsafe(export_name = "__pender")] |
| 16 | fn __pender(context: *mut ()) { | 16 | fn __pender(context: *mut ()) { |
| 17 | let signaler: &'static Signaler = unsafe { std::mem::transmute(context) }; | 17 | let signaler: &'static Signaler = unsafe { std::mem::transmute(context) }; |
| 18 | signaler.signal() | 18 | signaler.signal() |
diff --git a/embassy-executor/src/arch/wasm.rs b/embassy-executor/src/arch/wasm.rs index f9d0f935c..6b36f8a5b 100644 --- a/embassy-executor/src/arch/wasm.rs +++ b/embassy-executor/src/arch/wasm.rs | |||
| @@ -15,7 +15,7 @@ mod thread { | |||
| 15 | use crate::raw::util::UninitCell; | 15 | use crate::raw::util::UninitCell; |
| 16 | use crate::{raw, Spawner}; | 16 | use crate::{raw, Spawner}; |
| 17 | 17 | ||
| 18 | #[export_name = "__pender"] | 18 | #[unsafe(export_name = "__pender")] |
| 19 | fn __pender(context: *mut ()) { | 19 | fn __pender(context: *mut ()) { |
| 20 | let signaler: &'static WasmContext = unsafe { std::mem::transmute(context) }; | 20 | let signaler: &'static WasmContext = unsafe { std::mem::transmute(context) }; |
| 21 | let _ = signaler.promise.then(unsafe { signaler.closure.as_mut() }); | 21 | let _ = signaler.promise.then(unsafe { signaler.closure.as_mut() }); |
diff --git a/embassy-executor/src/lib.rs b/embassy-executor/src/lib.rs index e47b8eb9f..cffc76699 100644 --- a/embassy-executor/src/lib.rs +++ b/embassy-executor/src/lib.rs | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #![cfg_attr(not(any(feature = "arch-std", feature = "arch-wasm")), no_std)] | 1 | #![cfg_attr(not(any(feature = "arch-std", feature = "arch-wasm")), no_std)] |
| 2 | #![allow(clippy::new_without_default)] | 2 | #![allow(clippy::new_without_default)] |
| 3 | #![allow(unsafe_op_in_unsafe_fn)] | ||
| 3 | #![doc = include_str!("../README.md")] | 4 | #![doc = include_str!("../README.md")] |
| 4 | #![warn(missing_docs)] | 5 | #![warn(missing_docs)] |
| 5 | 6 | ||
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index dbd70cbf4..ab845ed3b 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs | |||
| @@ -52,7 +52,7 @@ pub use self::waker::task_from_waker; | |||
| 52 | use super::SpawnToken; | 52 | use super::SpawnToken; |
| 53 | use crate::{Metadata, SpawnError}; | 53 | use crate::{Metadata, SpawnError}; |
| 54 | 54 | ||
| 55 | #[no_mangle] | 55 | #[unsafe(no_mangle)] |
| 56 | extern "Rust" fn __embassy_time_queue_item_from_waker(waker: &Waker) -> &'static mut TimerQueueItem { | 56 | extern "Rust" fn __embassy_time_queue_item_from_waker(waker: &Waker) -> &'static mut TimerQueueItem { |
| 57 | unsafe { task_from_waker(waker).timer_queue_item() } | 57 | unsafe { task_from_waker(waker).timer_queue_item() } |
| 58 | } | 58 | } |
| @@ -407,7 +407,7 @@ unsafe impl Sync for Pender {} | |||
| 407 | 407 | ||
| 408 | impl Pender { | 408 | impl Pender { |
| 409 | pub(crate) fn pend(self) { | 409 | pub(crate) fn pend(self) { |
| 410 | extern "Rust" { | 410 | unsafe extern "Rust" { |
| 411 | fn __pender(context: *mut ()); | 411 | fn __pender(context: *mut ()); |
| 412 | } | 412 | } |
| 413 | unsafe { __pender(self.0) }; | 413 | unsafe { __pender(self.0) }; |
| @@ -507,7 +507,7 @@ impl SyncExecutor { | |||
| 507 | /// The pender function must be exported with the name `__pender` and have the following signature: | 507 | /// The pender function must be exported with the name `__pender` and have the following signature: |
| 508 | /// | 508 | /// |
| 509 | /// ```rust | 509 | /// ```rust |
| 510 | /// #[export_name = "__pender"] | 510 | /// #[unsafe(export_name = "__pender")] |
| 511 | /// fn pender(context: *mut ()) { | 511 | /// fn pender(context: *mut ()) { |
| 512 | /// // schedule `poll()` to be called | 512 | /// // schedule `poll()` to be called |
| 513 | /// } | 513 | /// } |
diff --git a/embassy-executor/src/raw/waker_turbo.rs b/embassy-executor/src/raw/waker_turbo.rs index 435a0ff7e..9d0ad35ec 100644 --- a/embassy-executor/src/raw/waker_turbo.rs +++ b/embassy-executor/src/raw/waker_turbo.rs | |||
| @@ -26,7 +26,7 @@ pub fn task_from_waker(waker: &Waker) -> TaskRef { | |||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | #[inline(never)] | 28 | #[inline(never)] |
| 29 | #[no_mangle] | 29 | #[unsafe(no_mangle)] |
| 30 | fn _turbo_wake(ptr: NonNull<()>) { | 30 | fn _turbo_wake(ptr: NonNull<()>) { |
| 31 | // safety: our wakers are always created with `TaskRef::as_ptr` | 31 | // safety: our wakers are always created with `TaskRef::as_ptr` |
| 32 | let task = unsafe { TaskRef::from_ptr(ptr.as_ptr() as *const TaskHeader) }; | 32 | let task = unsafe { TaskRef::from_ptr(ptr.as_ptr() as *const TaskHeader) }; |
