Legato 16-01 WP8548
I tried to use fault action in the .adef file as per latest
john@john-ubuntuV2:~/ds201601/workspaceAvmsMqtt/mqttDemo1$ mkapp -t wp85 mqttDemo1.adef
/home/john/ds201601/workspaceAvmsMqtt/mqttDemo1/mqttDemo1.adef:33:11: error: Unrecognized section name 'faultAction'.
- is there a way to run (callback?) fault specific code triggered by the faultAction detection?
- also to run a callback on application stop
Thanks in advance
I suspect the error is because the ‘faultAction: stop’ is being used outside of a ‘processes:’ section. It’s on our “to do” list to make the error messages more helpful in cases like this.
We don’t currently have a callback for shutdown, but you can catch the SIGTERM signal using the Signal API and you can use atexit() to register for a callback when the process exits normally (not due to a signal).
Ah - got it.
I think the reason I got this wrong was - I was in a hurry - I was looking for a solution to the problem of what to do if the app failed.
I was in the middle of trying to fix it and searched the manual.
Didn’t back track to the previous heading processes: and assumed that faultAction: was like the other top level defs like start:
Maybe it would help if in the manual’s faultAction: example instead of
Downside is the manual gets bigger
Notes on .exit type code - the following works
// this function is called when this application stops
static void sig_appTermination_cbh(int sigNum)