httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <>
Subject Re: Handler method is it executed in mutex?
Date Fri, 04 Apr 2008 08:51:54 GMT
On Fri, 4 Apr 2008 09:04:50 +0200
Thib <> wrote:

> Hi,
> I'm developping an Apache Module, and I ask me a question about the
> execution of the handler.
> Do you know if the handler is executed in mutex (mutual exclusion) ?

It isn't.

> In the method create_snu_config, I allocate the memory :

Anything created there should be treated as read-only at request
processing time.  If you need to change that, you can create a
mutex, but even then you're in danger of leaking memory, by 
causing the child process to make its own copy of a global pool.

> And in the handler I read/write variables :
>          strncpy(s_cfg->eni.calling,&buffer[iDebut],iTaille);

Actually you can do that with a mutex, since you're not allocating
anything new from the config pool.  But I wouldn't recommend it.
Use a local variable.  If you need request-local variables to be 
available over multiple hooks/callbacks, use the request config.

Nick Kew

Application Development with Apache - the Apache Modules Book

View raw message