Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change 
notification.

The following page has been changed by MarcMongenet:
http://wiki.apache.org/httpd/ModuleLife

------------------------------------------------------------------------------
  === post_config call by children processes ===
  On WinNT MPM, the post_config hook is also called by the children processes.
  
- To know if we are in a child, we can check the AP_PARENT_PID environment 
variable: it is only set in children.
+ To know if we are in a child, we can check the AP_PARENT_PID environment 
variable: it is only set in children on the WinNT MPM.
+ 
+ '''Currently, modules seems bugguy ''(to be verified)'':''' they take for 
granted that the post_config hook is only called in the parent process.
+ 
+  * Example from 
http://www.codemass.com/mod_shm_counter/downloads/mod_shm_counter.c 
+ 
+ {{{
+     /* If we made it this far, we can safely initialize the module */
+     scfg = ap_get_module_config(s->module_config, &shm_counter_module);
+ 
+     ap_add_version_component(pconf, "mod_shm_counter/$Revision $");
+ 
+     /* Since we are still in the parent before any children have been
+      * created, it is safe to create the shared lock and shared segment.
+      * If we waited until a child had been created, we run in to a race
+      * condition.
+      */
+ 
+     rv = apr_global_mutex_create(&scfg->mutex, scfg->shmcounterlockfile,
+                                  APR_LOCK_DEFAULT, pconf);
+ }}}
  
  == Preventing module unloading ==
  To prevent module unloading, there is a ''sick and twisted hack'' (wrowe 
dixit): "the evil method is to use apr_dso_load() against the process pool to 
load it 'permanently'".

Reply via email to