in src/mod_rivet_ng/rivet_lazy_mpm.c [289:341]
void LazyBridge_ChildInit (apr_pool_t* pool, server_rec* server)
{
apr_status_t rv;
server_rec* s;
server_rec* root_server = module_globals->server;
module_globals->mpm = apr_pcalloc(pool,sizeof(mpm_bridge_status));
/* This mutex is only used to consistently carry out these
* two tasks
*
* - set the exit status of a child process (hopefully will be
* unnecessary when Tcl is able again of calling
* Tcl_DeleteInterp safely)
* - control the server_shutdown flag. Actually this is
* not entirely needed because once set this flag
* is never reset to 0
*
*/
rv = apr_thread_mutex_create(&module_globals->mpm->mutex,
APR_THREAD_MUTEX_UNNESTED,pool);
ap_assert(rv == APR_SUCCESS);
/* the mpm->vhosts array is created with as many entries as the number of
* configured virtual hosts */
module_globals->mpm->vhosts =
(vhost *) apr_pcalloc(pool,module_globals->vhosts_count*sizeof(vhost));
ap_assert(module_globals->mpm->vhosts != NULL);
/*
* Each virtual host descriptor has its own mutex controlling
* the queue of available threads
*/
for (s = root_server; s != NULL; s = s->next)
{
int idx;
apr_array_header_t* array;
rivet_server_conf* rsc = RIVET_SERVER_CONF(s->module_config);
idx = rsc->idx;
rv = apr_thread_mutex_create(&module_globals->mpm->vhosts[idx].mutex,
APR_THREAD_MUTEX_UNNESTED,pool);
ap_assert(rv == APR_SUCCESS);
array = apr_array_make(pool,0,sizeof(void*));
ap_assert(array != NULL);
module_globals->mpm->vhosts[idx].array = array;
module_globals->mpm->vhosts[idx].threads_count = 0;
}
module_globals->mpm->server_shutdown = 0;
}