} /* if/else */
if (!listener_may_exit) {
+ apr_thread_mutex_t *mutex;
+
if (ptrans == NULL) {
/* we can't use a recycled transaction pool this time.
* create a new transaction pool */
apr_allocator_owner_set(allocator, ptrans);
}
apr_pool_tag(ptrans, "transaction");
+
+ /* We need a mutex in the allocator to synchronize ptrans'
+ * children creations/destructions, but this mutex ought to
+ * live in ptrans itself to avoid leaks, hence it's cleared
+ * in ap_push_pool(). We could recycle some pconf's mutexes
+ * like we do for ptrans subpools, but that'd need another
+ * synchronization mechanism, whereas creating a pthread
+ * mutex (unix here!) is really as simple/fast as a static
+ * PTHREAD_MUTEX_INIT assignment, so let's not bother and
+ * create the mutex for each ptrans (recycled or not).
+ */
+ rv = apr_thread_mutex_create(&mutex,
+ APR_THREAD_MUTEX_DEFAULT,
+ ptrans);
+ if (rv != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, rv,
+ ap_server_conf, APLOGNO(10019)
+ "Failed to create transaction pool mutex");
+ resource_shortage = 1;
+ signal_threads(ST_GRACEFUL);
+ return NULL;
+ }
+ apr_allocator_mutex_set(apr_pool_allocator_get(ptrans),
+ mutex);
+
rv = lr->accept_func(&csd, lr, ptrans);
/* later we trash rv and rely on csd to indicate success/failure */
AP_DEBUG_ASSERT(rv == APR_SUCCESS || !csd);