/* Runs once per created child process. Perform any process
* related initionalization here.
*/
-static void h2_child_init(apr_pool_t *pool, server_rec *s)
+static void h2_child_init(apr_pool_t *pchild, server_rec *s)
{
+ apr_allocator_t *allocator;
+ apr_thread_mutex_t *mutex;
+ apr_status_t status;
+
+ /* The allocator of pchild has no mutex with MPM prefork, but we need one
+ * for h2 workers threads synchronization. Even though mod_http2 shouldn't
+ * be used with prefork, better be safe than sorry, so forcibly set the
+ * mutex here.
+ */
+ allocator = apr_pool_allocator_get(pchild);
+ mutex = apr_allocator_mutex_get(allocator);
+ if (!mutex) {
+ apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pchild);
+ apr_allocator_mutex_set(allocator, mutex);
+ }
+
/* Set up our connection processing */
- apr_status_t status = h2_conn_child_init(pool, s);
+ status = h2_conn_child_init(pchild, s);
if (status != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, status, s,
APLOGNO(02949) "initializing connection handling");
}
-
}
/* Install this module into the apache2 infrastructure.