ham_condition_control()

Updated: May 06, 2022

Perform control operations on an condition object in a HAM

Synopsis:

#include <ha/ham.h>

int ham_condition_control( ham_condition_t *chdl,
                           int command,
                           unsigned flags);

Arguments:

chdl
The HAM condition handle.
command
The additional command. See below.
flags
Any flag that is valid for the corresponding condition can be used when ham_condition_control() is being used to set flags, with the exception of HCONDNOWAIT if the existing condition already has some waitfor actions associated with it. See below.

Library:

libham

Description:

The ham_condition_control() function can be used to control the state of a condition object in a HAM. This function is designed to be extensible with additional commands. Currently, the following commands are defined:

HENABLE
Enable the item.
HDISABLE
Disable the item.
HADDFLAGS
Add the flags.
HREMOVEFLAGS
Remove the flags.
HSETFLAGS
Set the flags to the given value.
HGETFLAGS
Get the current flags.

When an condition item is enabled (the default), any event that occurs in relation to this event will trigger appropriate actions related to the condition. If a condition item is disabled, no events relating to it will be reacted to. If a condition is disabled, all actions under it are also disabled. Individual actions can be enabled and disabled using the corresponding control function for actions.

The HADDFLAGS, HREMOVEFLAGS, and HSETFLAGS commands can be used to modify the set of flags associated with the condition being controlled. Add flags and remove flags are used to either add to or remove from the current set of flags, the specified set of flags (as given in flags). The set flags function is called when the current set of flags is to be replaced by flags.

Flags

Any flag that is valid for the corresponding condition can be used when ham_condition_control() is being used to set flags, with the exception of HCONDNOWAIT if the existing condition already has some waitfor actions associated with it.

For the HENABLE and HDISABLE commands:

HRECURSE
Applies the command recursively.

Returns:

For the enable, disable, add flags, remove flags, and set flags functions:

0
Success.
-1
An error occurred (errno is set).

For the get flags function:

flags
Success.
-1
An error occurred (errno is set).

Errors:

EBADF
Couldn't connect to the HAM.
EINVAL
The command or flags variable is invalid.

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

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes