NAME | SYNOPSIS | FEATURES | DESCRIPTION | RETURN VALUES | ATTRIBUTES | SEE ALSO
#include<hr/hr.h>HR_EXIT_HDL(void);
HOT_RESTART
The HR_EXIT_HDL() macro is used to add an additional hot restart exit handler to a hot restartable actor's atexit(3STDC) function. The hot restart exit handler informs the Hot Restart Controller that the calling actor has successfully completed its task and can exit normally using exit(3STDC), without triggering a restart. If a restartable actor calls exit(3STDC) without first calling HR_EXIT_HDL(), the Hot Restart Controller considers this to be an abnormal termination and the actor's group will be restarted.
Call HR_EXIT_HDL() shortly before the restartable actor exits with exit(3STDC). If HR_EXIT_HDL() is called earlier in application code, and the actor then exits abnormally (before terminating successfully), the Hot Restart Controller will still consider that the actor has terminated successfully and the actor's group will not be restarted.
Once all members registered in a restart group have normally terminated using HR_EXIT_HDL() followed by exit(3STDC), the Hot Restart Controller does the following:
Frees all persistent memory blocks used to store the actor images and executed images for the actors in the group, and unregisters the name of each actor.
Frees any memory blocks that were allocated by the group's members using the HR_GROUP_KEY deletion key. See the man page for pmmAllocate(2RESTART) for a description of this key.
Adds the restart group's ID to the list of unused group IDs.
Care must be taken to ensure that all restartable actors registered in a restart group are able to exit cleanly using HR_EXIT_HDL(). This is important for restartable actors spawned with hrfexec(2RESTART) that are not respawned after a restart. See the man page for hrfexec(2RESTART) for more information concerning clean termination of spawned restartable actors.
The HR_EXIT_HDL() macro returns 0 if the connection to the exit function succeeds. Otherwise, -1 is returned.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | FEATURES | DESCRIPTION | RETURN VALUES | ATTRIBUTES | SEE ALSO