aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/thread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-executor/src/thread.rs')
-rw-r--r--embassy-executor/src/thread.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/embassy-executor/src/thread.rs b/embassy-executor/src/thread.rs
index f977d41e7..ef703003d 100644
--- a/embassy-executor/src/thread.rs
+++ b/embassy-executor/src/thread.rs
@@ -13,7 +13,6 @@ pub trait ThreadContext: Sized {
13 /// 13 ///
14 /// For example, on multi-core systems, this can be used to store the ID of the core that 14 /// For example, on multi-core systems, this can be used to store the ID of the core that
15 /// should be woken up. 15 /// should be woken up.
16 #[cfg(feature = "thread-context")]
17 fn context(&self) -> OpaqueThreadContext; 16 fn context(&self) -> OpaqueThreadContext;
18 17
19 /// Waits for the executor to be waken. 18 /// Waits for the executor to be waken.
@@ -49,16 +48,10 @@ impl<C: ThreadContext> ThreadModeExecutor<C> {
49 } 48 }
50 49
51 /// Create a new Executor using the given thread context. 50 /// Create a new Executor using the given thread context.
52 pub fn with_context(thread_context: C) -> Self { 51 pub fn with_context(context: C) -> Self {
53 #[cfg(not(feature = "thread-context"))]
54 let context = OpaqueThreadContext(());
55
56 #[cfg(feature = "thread-context")]
57 let context = thread_context.context();
58
59 Self { 52 Self {
60 inner: raw::Executor::new(Pender::Thread(context)), 53 inner: raw::Executor::new(Pender::Thread(context.context())),
61 context: thread_context, 54 context,
62 not_send: PhantomData, 55 not_send: PhantomData,
63 } 56 }
64 } 57 }