httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ricardo13 <ricardoogra...@gmail.com>
Subject Re: process initialisation in prefork-MPM
Date Mon, 27 Jul 2009 19:38:51 GMT

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/
> 
> 

-- 
View this message in context: http://www.nabble.com/process-initialisation-in-prefork-MPM-tp21127165p24686966.html
Sent from the Apache HTTP Server - Module Writers mailing list archive at Nabble.com.


Mime
View raw message