D daemon & GC?

JD via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 30 12:52:23 PDT 2014


> 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 :-)


More information about the Digitalmars-d-learn mailing list