N
nitroamos
Hey guys --
I have an idea on how to make my program a bit better -- but I'm not
sure if I can do it.
Do any of you know if there is a way to have a non-static function trap
a signal from the OS? The most interesting data from my program is only
output at the very end of the program, but sometimes I realize that I
need to stop it sooner (e.g. i set a parameter such that it is running
longer than I anticipated OR it crashes OR PBS wants to kill it) and it
would be nice if before quitting I could get it to print the best
results that it has so far (from all processors when run in parallel if
possible).
It seems that you have to use a static void function for both atexit
and signal (from signal.h) callbacks, but this would require making
everything that function uses static (e.g. the classes containing all
the data), right?
is there another way?
thanks!
I have an idea on how to make my program a bit better -- but I'm not
sure if I can do it.
Do any of you know if there is a way to have a non-static function trap
a signal from the OS? The most interesting data from my program is only
output at the very end of the program, but sometimes I realize that I
need to stop it sooner (e.g. i set a parameter such that it is running
longer than I anticipated OR it crashes OR PBS wants to kill it) and it
would be nice if before quitting I could get it to print the best
results that it has so far (from all processors when run in parallel if
possible).
It seems that you have to use a static void function for both atexit
and signal (from signal.h) callbacks, but this would require making
everything that function uses static (e.g. the classes containing all
the data), right?
is there another way?
thanks!