Ozzi wrote:

> Thomas Christian Chust wrote:
> 
>> I wonder why one would want to pass this cleanup argument to the daemon
>> procedure -- why should the spawned process simply perform cleanup once
>> the daemon procedure returns?
> 
> The problem with that, as I see it, is that sometimes daemons don't get
> to return normally, i.e. if they get killed. Of course any proper daemon
> will implement signal handlers and such so that it will clean up after
> itself and exit gracefully. [...]

I think it would suffice for daemonize to wrap the call to the daemon's
main procedure in a dynamic-wind block and call the cleanup function
from the exit thunk. Unless the daemon procedure terminates itself with
a low-level _exit or by sending itself a kill signal, the cleanup code
should then always be executed.

cu,
Thomas


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to