62 Commits

Author SHA1 Message Date
Dániel Buga
76d8a896bb
Make poll_to_despawn a no_op 2024-12-17 18:51:22 +01:00
Dániel Buga
2ca374fc9c
Don't force a wake to despawn 2024-12-17 18:47:56 +01:00
Dániel Buga
a011f48769
Make poll_to_despawn non-generic 2024-12-17 18:37:17 +01:00
Dániel Buga
7d5fbe26c9
Update state diagram 2024-12-17 18:17:36 +01:00
Dániel Buga
8fd08b1e97
Swap poll_fn to allow polling exited tasks 2024-12-17 18:07:06 +01:00
Dániel Buga
edb8f21a74
Take critical section instead of unsafe 2024-12-17 17:53:12 +01:00
Dániel Buga
c6ca46c825
Set RUN_QUEUED unconditionally 2024-12-17 16:52:13 +01:00
Dániel Buga
7eac184af0
Document task states and state transitions 2024-12-17 16:47:33 +01:00
Dániel Buga
fbd0fe06bd
Remove special handling of integrated timer items 2024-12-16 20:37:01 +01:00
Dániel Buga
3c121e5425
Remove special handling of integrated timer queue 2024-12-16 19:22:22 +01:00
Dániel Buga
b47a631abf
Rely on atomic load-store on all targets 2024-12-16 17:29:07 +01:00
Dániel Buga
b44ef5ccb4
Fix racy access of TaskHeader::executor 2024-12-16 16:01:08 +01:00
Dániel Buga
f389ba3721
Only lock once to wake a task 2024-12-16 15:28:19 +01:00
Dániel Buga
e861344b17
Fix comments and tweak task exit 2024-12-15 18:50:00 +01:00
Dániel Buga
5c4983236c
Make sure an exited task does not get stuck in a timer queue 2024-12-15 18:50:00 +01:00
Dario Nieuwenhuis
2f2e2c6031
Make integrated-timers the default, remove Cargo feature. 2024-12-15 18:49:57 +01:00
Dániel Buga
ec96395d08
Prevent task from respawning while in the timer queue 2024-12-13 21:20:57 +01:00
Dániel Buga
dc18ee29a0
Do not access task header 2024-12-10 21:31:42 +01:00
Dániel Buga
5a5495aac4
Refactor integrated-timers 2024-12-10 21:31:42 +01:00
Ulf Lilleengen
f0be2fdce4 Extend tracing api to support executor id and end task
Allow applications to provide a trace implementation that only needs to
implement APIs used by the embassy executor, and provide more context in
the event of multiple executors being used.
2024-12-09 15:16:03 +01:00
Dániel Buga
8ebe059ecb
Add initialize 2024-11-19 16:25:17 +01:00
Dániel Buga
ff02ee1a22
Only set callback once 2024-11-19 14:42:41 +01:00
Dario Nieuwenhuis
eca9aac194 Fix warnings in recent nightly. 2024-03-20 16:39:09 +01:00
xgroleau🐢
262518cfe5 fix: removed trailing comma 2024-02-08 09:02:07 -05:00
xgroleau🐢
09613e90de fix: missing 0 2024-02-08 09:01:07 -05:00
xgroleau🐢
d48620d58f fix: compilation for rtos trace 2024-02-08 08:59:06 -05:00
xgroleau🐢
5f36108896 fix: rtos-usage time missing 2024-02-06 15:08:05 -05:00
Dario Nieuwenhuis
f0606da9ad time: split queue driver too, don't reexport drivers. 2024-01-11 23:01:24 +01:00
Dario Nieuwenhuis
ac2aec4e7a executor: rename macro crate to embassy-executor-macros, bump it. 2023-12-07 00:48:30 +01:00
Dario Nieuwenhuis
27e6634c9d executor: add faster ARM-specific impl.
Does a wake+poll in 79 cycles in nrf52840.
2023-11-15 18:47:11 +01:00
Dario Nieuwenhuis
bef9b7a853 executor: remove atomic-polyfill. 2023-11-15 18:43:27 +01:00
Hailey Somerville
3a1ed823f8 write to TaskStorage::future via inline(never) fn to encourage RVO 2023-09-14 13:42:11 +10:00
Dániel Buga
0a73c84df0 Make AvailableTask public, deduplicate 2023-08-21 18:12:41 +02:00
Dániel Buga
890f29ccfe Update docs 2023-08-14 17:57:01 +02:00
Dániel Buga
07c3600127 Hide Pender 2023-08-14 16:35:48 +02:00
Dániel Buga
9954346143 Remove interrupt executor, remove PenderContext 2023-08-14 16:04:11 +02:00
Dániel Buga
3a51e2d9ca Make PenderContext actually pointer-size 2023-08-14 15:45:43 +02:00
Dániel Buga
4c4b12c307 Make PenderContext opaque 2023-08-14 15:16:40 +02:00
Dániel Buga
f6007869bf Remove the Pender enum 2023-08-14 09:00:08 +02:00
Dániel Buga
454a7cbf4c Remove pender-callback 2023-08-14 08:32:26 +02:00
Dániel Buga
ec6bd27df6 Remove thread-context feature 2023-08-14 08:22:22 +02:00
Dániel Buga
fbf50cdae8 Remove Pender wrapper 2023-08-12 22:13:08 +02:00
Dániel Buga
675b7fb605 POC: allow custom executors 2023-08-12 18:29:56 +02:00
loris
66faba2df7 add wake_task_no_pend for expired timer enqueue inside run_queue 2023-08-05 21:04:51 +02:00
Dániel Buga
a2501bd5c1 Allow clearing finished task from timer queue 2023-07-12 16:56:02 +02:00
Grant Miller
8290236ed6 executor: Replace unsound critical sections with atomics 2023-04-05 13:23:12 -05:00
Dario Nieuwenhuis
d3c4e4a20a executor: add Pender, rework Cargo features.
This introduces a `Pender` struct with enum cases for thread-mode, interrupt-mode and
custom callback executors. This avoids calls through function pointers when using only
the thread or interrupt executors. Faster, and friendlier to `cargo-call-stack`.

`embassy-executor` now has `arch-xxx` Cargo features to select the arch and to enable
the builtin executors (thread and interrupt).
2023-04-03 03:09:11 +02:00
Dario Nieuwenhuis
80972f1e0e executor,sync: add support for turbo-wakers.
This is a `core` patch to make wakers 1 word (the task pointer) instead of 2 (task pointer + vtable). It allows having the "waker optimization" we had a while back on `WakerRegistration/AtomicWaker`, but EVERYWHERE, without patching all crates.

Advantages:
- Less memory usage.
- Faster.
- `AtomicWaker` can actually use atomics to load/store the waker, No critical section needed.
- No `dyn` call, which means `cargo-call-stack` can now see through wakes.

Disadvantages:
- You have to patch `core`...
- Breaks all executors and other things that create wakers, unless they opt in to using the new `from_ptr` API.

How to use:

- Run this shell script to patch `core`. https://gist.github.com/Dirbaio/c67da7cf318515181539122c9d32b395
- Enable `build-std`
- Enable `build-std-features = core/turbowakers`
- Enable feature `turbowakers` in `embassy-executor`, `embassy-sync`.
- Make sure you have no other crate creating wakers other than `embassy-executor`. These will panic at runtime.

Note that the patched `core` is equivalent to the unpached one when the `turbowakers` feature is not enabled, so it should be fine to leave it there.
2023-03-30 17:55:55 +02:00
Dario Nieuwenhuis
21400da073 executor: Use AtomicPtr for signal_ctx, removes 1 unsafe. 2023-03-27 00:22:00 +02:00
Dario Nieuwenhuis
805bca1f5a executor: deduplicate doc comments. 2023-03-27 00:20:24 +02:00