D daemon & GC?

Dicebot via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 30 15:33:48 PDT 2014


On Saturday, 30 August 2014 at 19:52:24 UTC, JD wrote:
>> I tested it again, and it works fine in both 2.065 and 2.066.
>
> Be aware that you should comment out:
> //	close(STDOUT_FILENO);
> //	close(STDERR_FILENO);
>
> A daemon normally detaches itself from the terminal by closing 
> the STD* files. All D's runtime exception messages will not 
> appear in that case.
>
>> At least theoretically, whatever happens in the parent should 
>> not affect the child, so I don't really believe it has 
>> something to do with the way exit() works. You can actually 
>> test this by making the parent not exit immediately, but sleep 
>> for some time.
>
> Good point. I'll try that.
>
>> And just to be sure: have you tested your program without the 
>> call to daemonize?
>
> Yes, it writes a dot to the logfile every 2 seconds :-)

Last snippet works for me, dots get printed to the logfile as 
expected.


More information about the Digitalmars-d-learn mailing list