diff options
| author | Dániel Buga <[email protected]> | 2024-12-17 18:17:36 +0100 |
|---|---|---|
| committer | Dániel Buga <[email protected]> | 2024-12-17 18:17:36 +0100 |
| commit | 7d5fbe26c955bae4bd394d1092702bd81f849c9b (patch) | |
| tree | 546b9cad6ca95a2352c6212976fafb7a63f16ef1 /embassy-executor/src/raw/mod.rs | |
| parent | b51bd9ad040754728142df9991763b4672c31ecd (diff) | |
Update state diagram
Diffstat (limited to 'embassy-executor/src/raw/mod.rs')
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index 242e9c365..5df5ca9e1 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs | |||
| @@ -50,33 +50,32 @@ use super::SpawnToken; | |||
| 50 | /// A task's complete life cycle is as follows: | 50 | /// A task's complete life cycle is as follows: |
| 51 | /// | 51 | /// |
| 52 | /// ```text | 52 | /// ```text |
| 53 | /// ┌────────────┐ ┌────────────────────────┐ | 53 | /// ┌────────────┐ ┌────────────────────────┐ |
| 54 | /// ��─►��Not spawned │◄─6┤Not spawned|Run enqueued│ | 54 | /// │Not spawned │◄─5┤Not spawned|Run enqueued│ |
| 55 | /// │ │ ├7─►│ │ | 55 | /// │ ├6─►│ │ |
| 56 | /// │ └─────┬──────┘ └──────▲─────────────────┘ | 56 | /// └─────┬──────┘ └──────▲─────────────────┘ |
| 57 | /// │ 1 │ | 57 | /// 1 │ |
| 58 | /// │ │ ┌────────────┘ | 58 | /// │ ┌────────────┘ |
| 59 | /// │ │ 5 | 59 | /// │ 4 |
| 60 | /// �� ��─────▼────┴─────────┐ | 60 | /// ┌─────▼────┴─────────┐ |
| 61 | /// │ │Spawned|Run enqueued│ | 61 | /// │Spawned|Run enqueued│ |
| 62 | /// │ │ │ | 62 | /// │ │ |
| 63 | /// �� ���─────┬▲─────────────┘ | 63 | /// └─────┬▲─────────────┘ |
| 64 | /// │ 2│ | 64 | /// 2│ |
| 65 | /// │ │3 | 65 | /// │3 |
| 66 | /// �� ��─────▼┴─────┐ | 66 | /// ┌─────▼┴─────┐ |
| 67 | /// ��─4┤ Spawned │ | 67 | /// �� Spawned │ |
| 68 | /// │ │ | 68 | /// │ │ |
| 69 | /// └────────────┘ | 69 | /// └────────────┘ |
| 70 | /// ``` | 70 | /// ``` |
| 71 | /// | 71 | /// |
| 72 | /// Transitions: | 72 | /// Transitions: |
| 73 | /// - 1: Task is spawned - `AvailableTask::claim -> Executor::spawn` | 73 | /// - 1: Task is spawned - `AvailableTask::claim -> Executor::spawn` |
| 74 | /// - 2: During poll - `RunQueue::dequeue_all -> State::run_dequeue` | 74 | /// - 2: During poll - `RunQueue::dequeue_all -> State::run_dequeue` |
| 75 | /// - 3: Task wakes itself, waker wakes task - `Waker::wake -> wake_task -> State::run_enqueue` | 75 | /// - 3: Task wakes itself, waker wakes task, or task exits - `Waker::wake -> wake_task -> State::run_enqueue` |
| 76 | /// - 4: Task exits - `TaskStorage::poll -> Poll::Ready` | 76 | /// - 4: A run-queued task exits - `TaskStorage::poll -> Poll::Ready` |
| 77 | /// - 5: A run-queued task exits - `TaskStorage::poll -> Poll::Ready` | 77 | /// - 5: Task is dequeued. The task's future is not polled, because exiting the task replaces its `poll_fn`. |
| 78 | /// - 6: Task is dequeued and then ignored via `State::run_dequeue` | 78 | /// - 6: A task is waken when it is not spawned - `wake_task -> State::run_enqueue` |
| 79 | /// - 7: A task is waken when it is not spawned - `wake_task -> State::run_enqueue` | ||
| 80 | pub(crate) struct TaskHeader { | 79 | pub(crate) struct TaskHeader { |
| 81 | pub(crate) state: State, | 80 | pub(crate) state: State, |
| 82 | pub(crate) run_queue_item: RunQueueItem, | 81 | pub(crate) run_queue_item: RunQueueItem, |
