You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sf...@apache.org on 2011/05/22 22:24:16 UTC
svn commit: r1126221 - in /apr/apr-util/branches/1.3.x: CHANGES
misc/apr_thread_pool.c
Author: sf
Date: Sun May 22 20:24:16 2011
New Revision: 1126221
URL: http://svn.apache.org/viewvc?rev=1126221&view=rev
Log:
Backport r1126207 from trunk:
Fix thread unsafe pool usage. This is a potential culprit for the
occasional testreslist failures.
Modified:
apr/apr-util/branches/1.3.x/CHANGES
apr/apr-util/branches/1.3.x/misc/apr_thread_pool.c
Modified: apr/apr-util/branches/1.3.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.3.x/CHANGES?rev=1126221&r1=1126220&r2=1126221&view=diff
==============================================================================
--- apr/apr-util/branches/1.3.x/CHANGES [utf-8] (original)
+++ apr/apr-util/branches/1.3.x/CHANGES [utf-8] Sun May 22 20:24:16 2011
@@ -1,8 +1,7 @@
-*- coding: utf-8 -*-
Changes with APR-util 1.3.13
-
-Changes with APR-util 1.3.13
+ *) apr_thread_pool: Fix thread unsafe pool usage. [Stefan Fritsch]
*) Improve platform detection for bundled expat by updating
config.guess and config.sub. [Rainer Jung]
Modified: apr/apr-util/branches/1.3.x/misc/apr_thread_pool.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.3.x/misc/apr_thread_pool.c?rev=1126221&r1=1126220&r2=1126221&view=diff
==============================================================================
--- apr/apr-util/branches/1.3.x/misc/apr_thread_pool.c (original)
+++ apr/apr-util/branches/1.3.x/misc/apr_thread_pool.c Sun May 22 20:24:16 2011
@@ -353,13 +353,18 @@ APU_DECLARE(apr_status_t) apr_thread_poo
*me = NULL;
tp = apr_pcalloc(pool, sizeof(apr_thread_pool_t));
- tp->pool = pool;
-
+ /*
+ * This pool will be used by different threads. As we cannot ensure that
+ * our caller won't use the pool without acquiring the mutex, we must
+ * create a new sub pool.
+ */
+ rv = apr_pool_create(&tp->pool, pool);
+ if (APR_SUCCESS != rv)
+ return rv;
rv = thread_pool_construct(tp, init_threads, max_threads);
- if (APR_SUCCESS != rv) {
+ if (APR_SUCCESS != rv)
return rv;
- }
- apr_pool_cleanup_register(pool, tp, thread_pool_cleanup,
+ apr_pool_cleanup_register(tp->pool, tp, thread_pool_cleanup,
apr_pool_cleanup_null);
while (init_threads) {