Expand description
async_precmd submodule — run precmd-style hooks on the worker pool so they
don’t block prompt rendering (writes into the shared param table).
async_precmd hook — run precmd-style functions on a POOL WORKER THREAD so
they never block prompt rendering.
zsh’s precmd hooks run synchronously before the prompt paints, so a slow
hook stalls the prompt. async_precmd is a new lifecycle hook (no zsh
equivalent): its functions run on the shared worker pool AFTER the prompt is
built/rendered, writing their results into the shared, RwLock-synchronized
global param table. The prompt reads whatever is currently there and never
waits — a slow segment simply updates a prompt or two later.
Registration mirrors zsh’s hook arrays:
- a function literally named
async_precmd, and/or - members of the
async_precmd_functionsarray.
Built on the Phase-1 crate::vm_helper::ShellExecutor::new_worker
lightweight worker executor. No isolation is needed here: async_precmd
WANTS its typeset -g writes to land in the shared table.
Functions§
- fire_
async_ precmd - Fire the
async_precmdhooks on a worker thread. Called frompreprompt()AFTER precmd + prompt render, so the prompt is already on screen. Returns immediately (non-blocking): it submits ONE closure to the shared worker pool and lets it run in the background. Debounced via [RUNNING]. - set_
session_ pool - Publish the session worker pool. Called once from
ShellExecutor::new().