Commit Graph

59 Commits

Author SHA1 Message Date
Aleksandr Krotov
6b19c0abd1
Fix #2100 - function address comparison 2023-10-25 11:01:35 +03:00
Hailey Somerville
b9d4b18f14 update UninitCell::write call in arch::wasm too 2023-09-14 13:59:24 +10:00
Hailey Somerville
3a1ed823f8 write to TaskStorage::future via inline(never) fn to encourage RVO 2023-09-14 13:42:11 +10:00
Dario Nieuwenhuis
5e613d9abb Sync all fmt.rs files. 2023-08-30 01:37:18 +02:00
Dániel Buga
54e2e17520 Avoid dead code warning 2023-08-26 12:53:39 +02: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
e4f3979ec8 Don't check context if only thread-mode is enabled 2023-08-14 16:46:02 +02:00
Dániel Buga
07c3600127 Hide Pender 2023-08-14 16:35:48 +02:00
Dániel Buga
da4f15d944 Fix fn name 2023-08-14 16:34:10 +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
986a63ebb8 Remove the non-specific thread-mode executor 2023-08-14 15:41:53 +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
6ab0d71d92 Tweak identifiers and comments 2023-08-12 22:42:50 +02:00
Dániel Buga
d5e66f6f87 Lift thread-context feature restrictions 2023-08-12 22:20:11 +02:00
Dániel Buga
bce250bbdc Remove unnecessary !Send markers 2023-08-12 22:17:03 +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
Kaspar Schleiser
54fc933932 embassy-executor: introduce InterruptExecutor::spawner() 2023-06-16 12:59:23 +02:00
Dániel Buga
5fe36b6bb0 Work around xtensa deadlock, take 2 2023-05-13 15:04:02 +02:00
Grant Miller
6a6c673c5f Executor: Replace unnecessary atomics in runqueue 2023-04-13 14:21:41 -05:00
Roy Buitenhuis
32836129f6 re-export main_riscv macro as main for riscv arch. 2023-04-11 14:59:38 +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
b41ee47115 executor: unify export mod. 2023-04-03 01:11:42 +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
Grant Miller
41d558a5f4 executor: Allow TaskStorage to auto-implement Sync 2023-03-20 17:08:15 -05:00
Grant Miller
791fbb3ca0 Make poll_fn lazily initialized again 2023-01-31 21:46:25 -06:00
Grant Miller
4a8e9cf4d9 Add internal AvailableTask type 2023-01-31 19:04:41 -06:00
Grant Miller
fb1946be7f Replace the pointer in TaskHeader with an Option<&Executor> 2023-01-31 18:59:03 -06:00
Grant Miller
a697f1517a Set poll_fn in TaskStorage::new 2023-01-31 18:59:03 -06:00
Grant Miller
b6ca6d699a Make wake_task safe 2023-01-29 16:32:12 -06:00
Grant Miller
48e1aab762 executor: Replace NonNull<TaskHeader> with TaskRef 2023-01-29 15:52:13 -06:00
Dario Nieuwenhuis
10c9cc31b1 Remove unnecessary use of atomic-polyfill.
Only use it when CAS is actually needed.
2022-12-23 20:46:49 +01:00
bors[bot]
a4f9e7cbcc
Merge #1071
1071: refactor: autodetect macro variant r=Dirbaio a=lulf

Apply heuristics using target_arch, target_os and target_family to determine which variant of the entry point to use.

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2022-11-23 13:21:59 +00:00
Ulf Lilleengen
04a7d97673
refactor: autodetect macro variant
Export all main macro per target architecture from embassy-macros,
and select the appropriate macro in embassy-executor.
2022-11-23 13:54:59 +01:00
Ulf Lilleengen
50c5cc5db6
fix: revert race condition introduced for riscv 2022-11-23 13:17:05 +01:00
Sijmen Woutersen
e70ae71ecc restore SIGNAL_WORK_THREAD_MODE 2022-11-12 10:58:37 +01:00
Sijmen Woutersen
6e1120e17e riscv support 2022-11-10 17:39:41 +01:00
ivmarkov
560eecdb73 Remove the _embassy_time_schedule_wake magic 2022-10-26 18:05:27 +03:00
ivmarkov
4d5550070f Change time Driver contract to never fire the alarm synchronously 2022-10-24 09:17:43 +03:00
Dario Nieuwenhuis
a0487380da Replace futures::future::poll_fn -> core::future::poll_fn. 2022-09-22 16:42:49 +02:00