You must distinguish between two signals: those that tell the daemons to "reload" and those that complete the daemon ("kill"). In the case of "kill" you do not need to let go of anything. Your process will die, the OS will clear everything that you allocated. If you use shared memory, you must perform a cleanup on restart. Do not do anything in the kill handler, which can cause problems. Just die.
In the event of a reboot, you can call any function that you like, as the user wants you to "close orderly." In this case, there is little chance that you will get the same signal again (so it doesnβt matter if the function is reentrant or not).
source share