diff -urbp apr-util-1.3.9/misc/apr_thread_pool.c apr-util-new/misc/apr_thread_pool.c --- apr-util-1.3.9/misc/apr_thread_pool.c 2009-09-15 15:48:28.000000000 -0400 +++ apr-util-new/misc/apr_thread_pool.c 2009-09-25 08:42:12.000000000 -0400 @@ -379,7 +379,12 @@ APU_DECLARE(apr_status_t) apr_thread_poo apr_pool_cleanup_null); while (init_threads) { + /* Grab the mutex as apr_thread_create() and thread_pool_func() will + * allocate from (*me)->pool. This is dangerous if there are multiple + * initial threads to create. */ + apr_thread_mutex_lock((*me)->lock); rv = apr_thread_create(&t, NULL, thread_pool_func, *me, (*me)->pool); + apr_thread_mutex_unlock((*me)->lock); if (APR_SUCCESS != rv) { break; }