Attach an application as a self-attached entity
#include <ha/ham.h> ham_entity_t *ham_attach_self( const char *ename, _Uint64t hp, int hpdl, int hpdh, unsigned flags );
libham
You use the ham_attach_self() call to attach an application as a self-attached entity to the HAM. A self-attached entity is a process that chooses to send heartbeats to the HAM, which will then monitor the process for failure. Self-attached entities can, on their own, decide at exactly what point in their lifespan they want to be monitored, what conditions they want acted upon, and when they want to stop the monitoring.
Note that self-attached entities can be any processes, not just those in session 1 (unlike the requirement for the ham_attach() call).
Once an entity has been attached, you can add conditions and actions to it.
Since the ham_attach*() functions open a connection to the HAM, for convenience they also perform the initial ham_connect() call. So any client that makes a ham_attach_self() call doesn't need to call ham_connect() or ham_disconnect() before and after the call to ham_attach_self(). |
The arguments are as follows:
Note that here you're specifying the heartbeat interval — the client must still call the ham_heartbeat() function to actually transmit the heartbeat. |
A valid handle to an entity on success; otherwise, NULL (errno is set).
In addition to the above errors, the HAM returns any error it encounters while servicing the request to add a new entity to its context.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
ham_attach(), ham_condition(), ham_connect(), ham_detach(), ham_detach_self(), ham_disconnect(), ham_heartbeat()
procmgr_daemon() in the QNX Neutrino Library Reference