NAME
ttypt/xy-watch.h - Filesystem-watch auto-reload for xy modules.
SYNOPSIS
Functions
Spawn the background watcher thread.
Stop the background watcher thread and release all resources.
Add a module path to the watch set.
Remove a module path from the watch set.
Detailed Description
Filesystem-watch auto-reload for xy modules.
libxylem-watch monitors loaded module .so files with inotify and calls xy_reload() automatically when a file is updated on disk.
Typical usage:
xy_load("mods/foo"); xy_watch_add("mods/foo"); // start watching xy_watch_start(); // spawn background thread (idempotent) ... xy_watch_stop(); // clean up before exit
xy_watch_start() is idempotent โ calling it multiple times is safe. xy_watch_add() may be called before or after xy_watch_start().
Thread safety: all functions are safe to call from any thread.
Platform: Linux only (uses inotify).
Function Documentation
int xy_watch_add (const char * fname)
Add a module path to the watch set.
Parameters
fname The same path string passed to xy_load() (without .so suffix).
Returns
0 on success, -1 on error (check errno).
void xy_watch_remove (const char * fname)
Remove a module path from the watch set.
Parameters
fname The same path string passed to xy_load() (without .so suffix).
int xy_watch_start (void )
Spawn the background watcher thread. Safe to call multiple times; subsequent calls are no-ops.
Returns
0 on success, -1 on error (check errno).
void xy_watch_stop (void )
Stop the background watcher thread and release all resources. Blocks until the thread has exited. After this, xy_watch_start() may be called again to restart watching.
Author
Generated automatically by Doxygen for libxylem from the source code.