Getting summaries from programs that don't exit

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in Insure++
If you have a program that runs perpetually i.e client/server application daemon, service or something similar to any of these. You will typically not get a summary from insure because insure does not create the summaries until after exit has been called.

There are couple of things that can be done about this

1. you can run the program in the systems debugger and from a point in your programs execution where it would be safe for you to exit you can call exit(0) . Insure will intercept the call to exit() and produce it's summaries before insure itself calls the final system exit routine.

2. You can in the top level control loop add some kind of dynamic check for a condition that can be made true during execution. One simple one is to look for the existance of a file and if that file exists then call exit like:
if (access ("/tmp/byebye", F_OK) == 0) { unlink("/tmp/byebye"); exit(0); }
Then at some point during execution after you feel your program has ran long enough you can just create the file.
Sign In or Register to comment.