Daemonisation with a feedback
This short article describes how to use in your application a proposed set of functions which simplifies building daemons with a feedback from a child process to a parent one.
The code has been tested with gcc 3.4.2 on Linux. Most probably it will work without changes on other platforms.
First version of the daemonisation functions set. It uses SIGUSR1 and SIGUSR2 sinals' handlers, two bool variables and the sleep call for waiting. It is good only because it was extensively used in some projects.
Second version of the daemonisation functions set. It does not use global variables. It uses the sigwait call for waiting. It is not perfect only because it was not tested thorough in real applications.
Last Updated: December 10, 2005