httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Lewis <...@joe-lewis.com>
Subject Re: process initialisation in prefork-MPM
Date Mon, 27 Jul 2009 21:28:04 GMT
ricardo13 wrote:
> hi,
>
> For example, That's right ??
>
> #include <httpd.h>
> static int global_variable;
>
> static int init_child(request *r) 
> {
>   printf("HEllo World");
> }
>
> static void register_hooks(apr_pool_t *pool)
> {
>    ap_hook_child_init(init_child, NULL, NULL, APR_HOOK_MIDDLE);
> }
>
> /* the main config structure */
> module AP_MODULE_DECLARE_DATA teste_module = {
>    STANDARD20_MODULE_STUFF,
>    NULL,        	/* create per-dir    config structures */
>    NULL,         	/* merge  per-dir    config structures */
>    NULL,		 /* create per-server config structures */
>    NULL,	        /* merge  per-server config structures */
>    NULL,        	/* table of config file commands       */
>    register_hooks       /* register hooks                      */
> };
>
> I was using post_config, but now I changes for child_init.
>
> THank you
> Ricardo
>
>
>
> Joe Lewis-2 wrote:
>   
>> ricardo13 wrote:
>>     
>>> HI,
>>>
>>> Sorry, but I'm using Worker MPM.
>>> How do I declare variable using Worker MPM ?
>>>
>>>
>>> Thank you
>>> Ricardo
>>>   
>>>       
>> I always suggest the same method, regardless of the MPM, for 
>> configuration options. If you absolutely don't want to use shared memory 
>> and you use the worker MPM (threaded), you should be able to declare a 
>> regular variable with your programming language of choice as static 
>> variable, and don't reset it on a post_config unless it is only the 
>> first time post_config is being run (otherwise, as a thread is killed 
>> and started, it could reset your variable).
>>
>> -- 
>> Joe Lewis
>> Chief Nerd 	SILVERHAWK <http://www.silverhawk.net/> 	(801) 660-1900
>>
>> ------------------------------------------------------------------------
>> /An army is stengthened by labor and enervated by idleness.
>> --Vegetius, A.D. 4th Century/
>>
>>
>>     
>
>   
That is the idea. I've always preferred post_config() myself.

-- 
Joe Lewis
Chief Nerd 	SILVERHAWK <http://www.silverhawk.net/> 	(801) 660-1900

------------------------------------------------------------------------
/It's amazing that fans want to see me play. It's kind of scary. I guess 
that's what is wrong with our society.
-- John Kruk on being chosen to the 1993 All-Star team/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message