From: Yves <yme...@pe...> - 2005-01-20 15:40:49
|
>> 1/ Implement a basic pp_exit() function : >> void pp_exit(void) { >> exit(); >> } > > void pp_exit(int status) > preferably. Yes of course. In the future, it could become pp_exit(int status, int par= am) where param is an int or can be something else (like what to close and what not to cl= ose). Depends on what we need. >> 2/ Replace *all* calls to exit() with pp_exit(). Don't make a macro fo= r that. It has >> to >> be a real replacement. > > there are around 50 exit calls :) OK. Much work, but can be done. >> 4/ work on pp_exit() in order to make it do what we want. Also remove = the calls to >> atexit() and do something else. > > In the case of this problem: if the main process finishes, you should > call close_all_log_sources, but any subproces that exits should not do > this. perhaps pp_exit can do different things depending on the status > flag. So I have a feeling this will not be trivial. With pp_exit, it can become trivial, with the use of additionnal paramete= rs to pp_exit. You can think of a binary OR of options to say what pp_exit should do and= should not do. For example : pp_exit(EXIT_FAILURE, CLOSE_ALL | WRITE_A_NICE_MESSAGE_IN_THE_LOG | DO_NOT_REMOVE_THE_PIPE); Yves --=20 - Homepage - http://ymettier.free.fr - http://www.logicacmg.com - - GPG key - http://ymettier.free.fr/gpg.txt - - Maitretarot - http://www.nongnu.org/maitretarot/ - - Perfparse - http://perfparse.sf.net/ - |