Add a waitfor action to a condition


#include <ha/ham.h>

ham_action_t *ham_action_waitfor(
                 ham_condition_t *chdl,
                 const char *aname, 
                 const char *path, 
                 int delay,
                 unsigned flags);




The ham_action_waitfor() function adds an action (aname) to a given condition. In this case, the action is one that lets you insert arbitrary delays into a sequence of actions.

The waitfor call fails if the specified path does not appear in the specified interval.

The handle (chdl) is obtained either:

You use the delay parameter to specify the “waitfor” period in milliseconds.

You can also specify a path in order to control the delay. If path is specified, then the action waits for either the pathname to appear in the namespace or for the period specified in delay, whichever is lower.

Currently the following flag is defined:

Indicates that the action is to be automatically rearmed after the entity that it belongs to is restarted. By default, this flag is disabled — actions automatically get pruned across restarts of the entity. Note that if the condition that this action belongs to is pruned after a restart, this action will also be removed, regardless of the value of this flag.


A valid handle to an action to a condition, or NULL if an error occurred (errno is set).


Couldn't connect to the HAM.
The name given in aname is invalid (e.g., it contains the / character) or is NULL.

The connection to the HAM is invalid. This happens when the process that opened the connection (using ham_connect()) and the process that's calling ham_action_waitfor() aren't the same.

The delay specified is invalid. Only values greater than zero are permitted.

The condition into which the action is being added has the HCONDNOWAIT set.

The name provided for the action already exists.
The name given (in aname) is too long, i.e. it exceeds _POSIX_PATH_MAX (defined in <limits.h>). Note that the combined length of an entity/condition/action name is also limited by _POSIX_PATH_MAX.
There's no entity or condition specified by the given handle (chdl).
Not enough memory to create a new handle.

In addition to the above errors, the HAM returns any error it encounters while servicing this request.


QNX Neutrino

Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes