HP-UX Event ManagerProgrammer's Guide
Signal Handling
The EVM API does not use signals in its normal processing and does not interfere with an
application program's use of signals. However, because the system's default action is to silently
terminate a process that attempts to write to a local connection if no process exists to read the
data, a client process can exit without trace if the EVM daemon terminates before or during
activity on the connection.
To prevent this, the EvmConnCreate function checks whether the caller has already established
a handler for SIGPIPE; if not, the function installs a default handler. The handler takes no action
if the signal occurs, but its presence prevents the client from terminating. A program can override
the EVM handler by setting its own handler either before or after the call to EvmConnCreate.
If it is important that the program takes the default action, set the action to SIG_DFL after calling
EvmConnCreate.
For more information about signals, see signal(2).
EVM Multithreaded Programs
All EVM API functions are thread-safe. In few cases where it is necessary to use internal static
storage, the APIs use locks to protect the storage from simultaneous access by separate threads.
Nevertheless, if you are using EVM API calls in a multithreaded program, you must take certain
precautions to avoid the following synchronization errors:
1. If possible, restrict the use of any entity returned by any API function to the thread in which
it was established. Table 3-1 lists the entities that must be thread-safe.
Table 3-1 Entities to be Thread Safe
Returned byTypeEntity
EvmConnCreate()EvmConnection_t
Connection context
EvmEventCreate()
EvmEventCreateVa()
EvmEventRead()
EvmEventDup()
EvmEvent_t
Event
EvmItemGet()EvmItemValue_t
Data item
EvmItemListGet()EvmItemList_t
Data item list
EvmVarGet()EvmVarValue_t
Variable
EvmVarListGet()EvmVarList_t
Variable list
EvmFilterCreate()EvmFilter_t
Event filter
EvmConnFdGet()EvmFd_t
Connection fd
2. If it is necessary to refer to these entities in more than one thread, you must protect them
against simultaneous access, or perform updates by using locks.
If you do not follow these rules, random errors can occur.
Reassigning and Replicating EVM Events
If you need to reassign EVM events after they are created, received, or read, you must know how
an event is held in memory.
32 The EVM Programming Interface