httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sami Tikka" <>
Subject Re: Thread terminatinos ?
Date Mon, 29 Dec 2003 20:37:15 GMT
On Thu, Dec 11, 2003 at 11:25:08AM +0200, Nasko wrote:

>     2) How can I be notified when a thread is destroyed so I can close the DB connection

I think the correct way to do this would be to start a database thread
in child_init and register a thread shutdown callback with the pool
that is passed as parameter to to child_init. This pool is a "child"
pool and there is one in every "worker", be they processes or threads.
Child_init is a callback which is called right after creation of a
worker. When the pool is destroyed (because the worker is shut down),
the callbacks registered with the pool are called.

See ap_hook_child_init() and apr_pool_cleanup_register()

(Hmm... what is the correct terminology? Should I talk about children?
But that sort of implies that they are processes whereas on Windows
they are threads. I've used the word "worker" but perhaps someone
could confuse that with the child processes of the Worker MPM.)

  Sami Tikka                          tel: +358 9 2520 5115
  Senior Software Engineer            fax: +358 9 2520 5013
  F-Secure Corporation      
  F-Secure: Securing the Mobile, Distributed Enterprise

View raw message