-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationp3-lowCosmetic, noisy logs, minor polishCosmetic, noisy logs, minor polishzig-forkRequires Ghostty fork changesRequires Ghostty fork changes
Description
Summary
Out of ~80+ exported C API functions in ghostty.h, only 2 have any thread safety documentation (ghostty_surface_write_output in Zig, and ghostty_surface_tmux_detach mentioning "Safe to call from any thread").
Functions like ghostty_surface_draw, ghostty_surface_set_size, ghostty_surface_set_focus, ghostty_surface_text, ghostty_surface_key, etc. all have implicit requirements about being called from specific threads, but this is never stated.
What's Needed
For each exported function, document:
- Which thread(s) it can be called from (main thread, IO thread, any thread)
- Which functions conflict with each other (cannot be called concurrently)
- Data lifetime for pointer parameters and return values
- Whether the function blocks or is async
Severity
MEDIUM — The iOS embedder must guess threading requirements. Mistakes cause subtle data races.
Source
Identified during code review of daiimus/ghostty:ios-external-backend.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationp3-lowCosmetic, noisy logs, minor polishCosmetic, noisy logs, minor polishzig-forkRequires Ghostty fork changesRequires Ghostty fork changes