You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fs: an event-driven file watch (inotify / FSEvents / ReadDirectoryChangesW) for hot reload #21
An event-driven file watch in mcpplibs.os::fs: a program says which files or directories to watch and is told when one changes, instead of polling last_write_time.
Why
openmui's development mode reloads an application's TypeScript, views and themes when they are saved (hot reload, live design). The target is save-to-screen ≤ 100 ms at p95. Today the player polls each watched file's modification time every frame (1/60 s) in development; that meets the budget but wakes the program every frame even when nothing changes, and the cost grows with the number of files (a project's imported modules, components, themes).
Shape (a suggestion)
auto w = mcpplibs::os::fs::watcher::open(); // result<watcher>
w->add(path); // a file, or a directory (recursive optional)auto changed = w->take(); // non-blocking: the paths changed since the last takeauto changed = w->wait_for(std::chrono::milliseconds); // or waitint fd = w->native_handle(); // to join an event loop (where the platform has one)
Backends: inotify (Linux), FSEvents or kqueue (macOS), ReadDirectoryChangesW (Windows); errc::not_supported where there is none (Emscripten), so callers fall back to polling. Editors that save by rename (write a temporary, rename over) should still report the watched path.
Released in mcpplibs.os 0.4.2 (#22, in mcpp-index): fs::watcher holds names (files and directories, which need not exist yet) and answers which of them changed since the last answer, each once. inotify (Linux), kqueue (macOS) and ReadDirectoryChangesW (Windows) say when to look; each name's stamp, kind and identity say what changed, so every system answers alike. An ok image and Emscripten look when asked. native_handle() is the descriptor an event loop waits upon on Linux and macOS.
Activity
feat(W2): save to screen within a frame in development mode — the pla…
speak-agent commentedon Nov 9, 2026
Released in mcpplibs.os 0.4.2 (#22, in mcpp-index):
fs::watcherholds names (files and directories, which need not exist yet) and answers which of them changed since the last answer, each once. inotify (Linux), kqueue (macOS) and ReadDirectoryChangesW (Windows) say when to look; each name's stamp, kind and identity say what changed, so every system answers alike. An ok image and Emscripten look when asked.native_handle()is the descriptor an event loop waits upon on Linux and macOS.