Sorin Manolache wrote:
On Fri, Mar 13, 2009 at 16:21, Andrej van der Zee
<andrejvander...@gmail.com> wrote:
Hi,
Do not do this - a restart should be a restart, not a half of a restart.
You should be reinitializing whatever you do on a restart as well as a
start. That's the whole point.
I have one phrase that should illustrate why : memory leak.
For example, if your extension creates another thread or spawns another
process and that other thread/process doesn't clean up on a restart and
contains a memory leak, what good is restart to you? Restart has suddenly
become pointless.
It is good etiquette to honour the concept of a restart.
Okay, point taken. My extension indeed creates a thread. How can I know that
a user issues a restart? In other words, where can I kill my thread?
Register a function with the cleanup of the conf pool. The conf pool
is destroyed prior to a restart/kill/reload.
You have an example in the code I've sent you.
S
Perfect answer! Unfortunately, the post_config is called twice on a
restart, and with different memory pointers, so shared memory handles,
mutexes, etc, those will all suddenly disappear. You'd be forced to
initialize your post_config again or potentially segmentation fault the
server. So, that is a good excuse to implement some extra code to
handle restarting a thread anyway.
Joe