Commit 678f47e
committed
extmod/freertos: Implement core threading backend (Phases 3-8).
Phase 3 - HAL functions:
- mp_freertos_delay_ms/us with scheduler state awareness
- mp_freertos_ticks_ms/us using FreeRTOS tick count
Phase 4 - Thread state management:
- mp_thread_get_state/set_state using FreeRTOS TLS
- mp_thread_get_id returning task handle
Phase 5 - Mutex implementation:
- Binary semaphore for basic mutex
- Recursive mutex for GIL support
- Pre-scheduler safety (return success when scheduler not running)
Phase 6 - Thread lifecycle:
- mp_thread_init/deinit for main thread adoption
- mp_thread_create with GC-first allocation strategy
- Lazy reaper mechanism for finished thread cleanup
- Entry wrapper handling TLS setup and exit protocol
Phase 7 - GC integration:
- mp_thread_gc_others scanning all thread stacks
Phase 8 - GIL integration:
- mp_thread_gil_exit with yield for fairness
Signed-off-by: Andrew Leech <[email protected]>1 parent 10fde15 commit 678f47e
File tree
3 files changed
+433
-2
lines changed- extmod/freertos
3 files changed
+433
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
37 | 90 | | |
38 | 91 | | |
0 commit comments