Skip to content

Conversation

@bugadani
Copy link
Contributor

This PR adds a non-panicking way of accessing a task's TimerQueueItem. This allows using integrated timer queues with embassy executors along with some other method for block_on or others.

Split out of #4934

Copilot AI review requested due to automatic review settings December 18, 2025 09:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a fallible variant of the waker-to-task conversion mechanism, enabling non-panicking access to a task's TimerQueueItem. This allows for more flexible integration with embassy executors when using alternative timer queue implementations or block_on methods.

  • Adds try_task_from_waker as a fallible alternative to task_from_waker
  • Introduces __try_embassy_time_queue_item_from_waker as the public FFI interface
  • Updates the panic message to clarify when generic timer queues are involved

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
embassy-executor/src/raw/waker_turbo.rs Adds try_task_from_waker function for turbowakers mode
embassy-executor/src/raw/waker.rs Refactors task_from_waker to use new try_task_from_waker helper and updates error message
embassy-executor/src/raw/mod.rs Adds new FFI function __try_embassy_time_queue_item_from_waker and imports the fallible helper
embassy-executor/CHANGELOG.md Documents the addition of the new function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Migrate `cortex-ar` to `aarch32-cpu`. The feature name `arch-cortex-ar` remains the same and
legacy ARM architectures are not supported.
- Added `run_until` to `arch-std` variant of `Executor`.
- Added `__try_embassy_time_queue_item_from_waker`
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog entry could be more descriptive. Consider clarifying that this is a fallible variant of __embassy_time_queue_item_from_waker that returns None instead of panicking when the waker is not from Embassy. This would help users understand the purpose of the new function.

Suggested change
- Added `__try_embassy_time_queue_item_from_waker`
- Added `__try_embassy_time_queue_item_from_waker`, a fallible variant of `__embassy_time_queue_item_from_waker` that returns `None` instead of panicking when the waker is not from Embassy.

Copilot uses AI. Check for mistakes.
@Dirbaio Dirbaio merged commit 905bdfa into embassy-rs:main Dec 19, 2025
16 checks passed
@bugadani bugadani deleted the fallible-from-waker2 branch December 19, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants