ham_action_waitfor()
Add a waitfor action to a condition
Synopsis:
#include <ha/ham.h> ham_action_t *ham_action_waitfor( ham_condition_t *chdl, const char *aname, const char *path, int delay, unsigned flags);
Arguments:
- chdl
- The HAM condition handle to which the action is added.
- aname
- The name of the action to add.
- path
- 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.
- delay
- The delay you want to insert in milliseconds.
- flags
- The flag indicating how the function will be rearmed. See below.
Library:
libham
Description:
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:
-
from one of the ham_condition*() functions to add conditions
or:
- by calling any of the ham_condition_handle() functions to request a handle to a specific condition.
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:
- HREARMAFTERRESTART
- Indicates that the action is to be automatically rearmed after the entity that it belongs to is restarted.
Returns:
A valid handle to an action to a condition, or NULL if an error occurred (errno is set).
Errors:
- EBADF
- Couldn't connect to the HAM.
- EINVAL
-
The name given in aname is invalid (e.g., it contains
the
character) or is NULL./
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.
- EEXIST
- The name provided for the action already exists.
- ENAMETOOLONG
-
The name given (in aname) is too long (i.e., it exceeds
_POSIX_PATH_MAX, defined in <limits.h>).
Note:The combined name length of an entity, condition, or action is also limited by _POSIX_PATH_MAX.
- ENOENT
- There's no entity or condition specified by the given handle (chdl).
- ENOMEM
- 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.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | No |
Thread | Yes |