chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] daemonize egg: redirect I/O?


From: Thomas Christian Chust
Subject: Re: [Chicken-users] daemonize egg: redirect I/O?
Date: Sat, 27 Oct 2007 20:04:11 +0200
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]