Sun Java System Web Server 6.1 SP11 NSAPI Programmer's Guide


The daemon_atrestart function lets you register a callback function named by fn to be used when the server terminates. Use this function when you need a callback function to deallocate resources allocated by an initialization function. The daemon_atrestart function is a generalization of the magnus_atrestart function.

The magnus.conf directives TerminateTimeout and ChildRestartCallback also affect the callback of NSAPI functions.


void daemon_atrestart(void (*fn)(void *), void *data);




void (* fn) (void *) is the callback function.

void *data is the parameter passed to the callback function when the server is restarted.


/* Register the log_close function, passing it NULL */
	 /* to close *a log file when the server is *//* restarted or shutdown. */
daemon_atrestart(log_close, NULL);NSAPI_PUBLIC void log_close(void *parameter)