mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-11-17 13:42:49 +00:00
Follow up to the merge of PR #10560 which skips input_delay when less than 1 KiB of program output is pending. Fix a data race: the I/O thread called vt_parser_pending_input_is_interactive() which read read.pos under the parser lock, but the main thread modifies read.pos without the lock while parsing, so taking the lock on one side only did not protect it. Instead, vt_parser_commit_write() now returns whether the pending input is small, computed from read.sz and write.pending, which are only modified with the lock held. This may overestimate while a parse is in progress or when an incomplete escape code is retained, in which case we simply fall back to the normal input_delay behavior. It also saves a lock/unlock cycle per read in the I/O thread. Bound the number of early main loop wakeups: since render() bypasses repaint_delay whenever input was read, input_delay was the effective cap on parse/render frequency for streaming output. Waking the main loop on every small read removed that cap entirely for programs that emit a continuous stream of small writes, costing CPU and increasing the chance of drawing partial screen updates. Now an early wakeup is only allowed if the previous wakeup was not itself early, so typed character echo is still delivered immediately while streams of small writes get at most two wakeups per input_delay. Replace the magic 1024 with SMALL_PENDING_INPUT_THRESHOLD, rename pending_input_is_interactive() to pending_input_is_small() since the check has nothing to do with interactivity, clarify the input_delay option documentation and add a changelog entry. |
||
|---|---|---|
| .. | ||
| _static | ||
| _templates | ||
| kittens | ||
| screenshots | ||
| actions.rst | ||
| basic.rst | ||
| binary.rst | ||
| build.rst | ||
| changelog.rst | ||
| clipboard.rst | ||
| color-stack.rst | ||
| conf.py | ||
| conf.rst | ||
| custom-shaders.rst | ||
| deccara.rst | ||
| desktop-notifications.rst | ||
| dnd-protocol.rst | ||
| extract-rst-targets.py | ||
| faq.rst | ||
| file-transfer-protocol.rst | ||
| glossary.rst | ||
| graphics-protocol.rst | ||
| index.rst | ||
| installer.sh | ||
| integrations.rst | ||
| intro_vid.rst | ||
| invocation.rst | ||
| keyboard-protocol.rst | ||
| kittens_intro.rst | ||
| launch.rst | ||
| layouts.rst | ||
| Makefile | ||
| mapping.rst | ||
| marks.rst | ||
| misc-protocol.rst | ||
| multiple-cursors-protocol.rst | ||
| notifications.py | ||
| open_actions.rst | ||
| overview.rst | ||
| performance.rst | ||
| pipe.rst | ||
| pointer-shapes.rst | ||
| press-mentions.rst | ||
| protocol-extensions.rst | ||
| quake-screenshots.rst | ||
| quickstart.rst | ||
| rc_protocol.rst | ||
| remote-control.rst | ||
| requirements.txt | ||
| sessions.rst | ||
| shell-integration.rst | ||
| support.html | ||
| support.rst | ||
| text-sizing-protocol.rst | ||
| underlines.rst | ||
| unscroll.rst | ||
| wide-gamut-colors.rst | ||