Skip to main content

lumen_signal_watch

Function lumen_signal_watch 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn lumen_signal_watch( name: *const c_char, cb: Option<LumenWatchFn>, user_data: *mut c_void, ) -> LumenStatus
Expand description

Subscribe to changes of the global signal name (ABI 0.4).

cb fires on the Lumen tick thread once per tick in which name’s committed [PropertyStore] value changed - and once on the first tick the value is observed after registration, so a freshly-registered watcher immediately learns the current state. This is a real commit-fired subscription wired through the running app’s [PropertyStore] dirty machinery, not a background polling loop; it only fires while the app is running (lumen_app_run / lumen_app_run_headless).

Registration is global and independent of any LumenApp handle, so it may be called before or after the app is built, from any thread. A second lumen_signal_watch for the same name adds another watcher (they do not replace one another). user_data carries the same Send/Sync contract as lumen_app_expose’s.

Returns LumenStatus::ErrBadArg when cb is null or name is null / non-UTF-8.