Repository navigation
machine/esp32: do not yield in UART writeByte from an interrupt - #6116
Draft
davecheney wants to merge 1 commit into
Draft
davecheney wants to merge 1 commit into
davecheney wants to merge 1 commit into
Conversation
runtime.Gosched has no interrupt check, so a println from an interrupt handler with a full TX FIFO would switch tasks, or take schedulerLock with the cores scheduler, from interrupt context. Busy-wait there instead, as machine_rp2_uart.go and machine_py32_uart_common.go already do.
davecheney
requested review from
deadprogram
and
a balanced review from Copilot
October 31, 2026 01:51
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the ESP32 UART interrupt-context change.
No open issues 🎉
What changed in this PR
Prevents ESP32 UART writes from yielding to the scheduler in interrupt context when the transmit FIFO is full.
Changes:
- Busy-waits inside interrupts while preserving scheduler yields outside interrupts.
- Aligns ESP32 behavior with the RP2 and PY32 UART implementations.
| File | Description |
|---|---|
src/machine/machine_esp32.go |
Guards gosched() with !interrupt.In() in UART writeByte. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
runtime.Gosched has no interrupt check, so a println from an interrupt handler with a full TX FIFO would switch tasks, or take schedulerLock with the cores scheduler, from interrupt context. Busy-wait there instead, as machine_rp2_uart.go and machine_py32_uart_common.go already do.