flux_watcher_start(3)

SYNOPSIS

void flux_watcher_start (flux_watcher_t *w);

void flux_watcher_stop (flux_watcher_t *w);

bool flux_watcher_is_active (flux_watcher_t *w);

void flux_watcher_unref (flux_watcher_t *w);

void flux_watcher_ref (flux_watcher_t *w);

bool flux_watcher_is_referenced (flux_watcher_t *w);

void flux_watcher_destroy (flux_watcher_t *w);

double flux_watcher_next_wakeup (flux_watcher_t *w);

Link with -lflux-core.

DESCRIPTION

flux_watcher_start() activates a flux_watcher_t object w so that it can receive events. If w is already active, the call has no effect. This may be called from within a flux_watcher_f callback.

flux_watcher_stop() deactivates a flux_watcher_t object w so that it stops receiving events. If w is already inactive, the call has no effect. This may be called from within a flux_watcher_f callback.

flux_watcher_is_active() returns a true value if the watcher is active (i.e. it has been started and not yet stopped) and false otherwise.

flux_watcher_unref() drops the watcher's reference on the reactor. This function is idempotent. flux_reactor_run() normally runs until there are no more active watchers with references.

flux_watcher_ref() restores the watcher's reference on the reactor. This function is idempotent.

flux_watcher_is_referenced() returns true if the watcher is referenced. All watchers are referenced unless updated with flux_watcher_unref().

Note

All watchers in the public API support flux_watcher_unref(), but some specialized watchers internal to flux-core do not. If in doubt about whether the call had any effect, check with flux_watcher_is_referenced().

flux_watcher_destroy() destroys a flux_watcher_t object w, after stopping it. It is not safe to destroy a watcher object within a flux_watcher_f callback.

flux_watcher_next_wakeup() returns the absolute time that the watcher is supposed to trigger next. This function only works for timer and periodic watchers, and will return a value less than zero with errno set to EINVAL otherwise.

RESOURCES

Flux: http://flux-framework.org

Flux RFC: https://flux-framework.readthedocs.io/projects/flux-rfc

Issue Tracker: https://github.com/flux-framework/flux-core/issues

SEE ALSO

flux_reactor_create(3)