I discovered that it is :)

Any idea how would I retrieve in this hook the module config structure? It 
seems it is not possible, as the only argument in the handler is a apr_pool_t 
structure.



________________________________
From: alin vasile <alinachegal...@yahoo.com>
To: modules-dev@httpd.apache.org
Sent: Sat, April 17, 2010 12:14:53 PM
Subject: Re: Fwd: Process lifetime and hooks to use




Hi Nick,

    Is ap_hook_monitor available in httpd 2.2.15?

Thanks,
Alin



________________________________
From: Nick Kew <n...@apache.org>
To: modules-dev@httpd.apache.org
Sent: Sat, April 17, 2010 12:10:46 PM
Subject: Fwd: Process lifetime and hooks to use

My reply seems to be lost in the ether ... try again.

Begin forwarded message:

> On 16 Apr 2010, at 20:51, Some Guy wrote:
> 
>> Hi all,
>> 
>> I would like to develop a module that periodically needs to fetch a file
>> from a remote site and update some data used by the child processes.  Is it
>> safe to create this thread in the post config hook?  I would like to do
>> something like:
>> 
>> Global thread fetches a file, and loads content
>> Thread signals that it has new data
>> A separate thread in each of the child processes gets the signal and updates
>> the cache in the child process.  The cache is only updated by this thread
>> and owned by the child process, so I lock it with a rwlock.  The cache is
>> read by request handlers, so I don't want to use a global lock since the
>> documentation implied it could be a performance issue.
>> 
>> Is this doable and which hooks / threading issues will I run into with this
>> approach?  It would be nice for the threads in the child process to be able
>> to concurrently read the data from the global thread after the global thread
>> has signaled new data is ready.  I did not see any type of global rw lock.
> 
> It's doable, with some reservations (and re your last sentence,
> see apr_global_mutex).  The hardest part will be to avoid leaking
> memory in the fetch.
> 
> However, it might be over-complicated.  Instead of your own thread
> in the parent process, why not use ap_hook_monitor?  And the mtime
> of the fetched file should work nicely as the signal to the children.
> 
> -- 
> Nick Kew


      

Reply via email to