From e4f3979ec8dd12fef1f44e78733917980045def0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Mon, 14 Aug 2023 16:46:02 +0200 Subject: [PATCH] Don't check context if only thread-mode is enabled --- embassy-executor/src/arch/cortex_m.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/embassy-executor/src/arch/cortex_m.rs b/embassy-executor/src/arch/cortex_m.rs index 8fe5644d..0806a22a 100644 --- a/embassy-executor/src/arch/cortex_m.rs +++ b/embassy-executor/src/arch/cortex_m.rs @@ -10,7 +10,8 @@ fn __pender(context: *mut ()) { let context = context as usize; #[cfg(feature = "executor-thread")] - if context == THREAD_PENDER { + // Try to make Rust optimize the branching away if we only use thread mode. + if !cfg!(feature = "executor-interrupt") || context == THREAD_PENDER { core::arch::asm!("sev"); return; }