summaryrefslogtreecommitdiff
path: root/util-misc/apr_reslist.c
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2013-03-23 16:12:52 +0000
committerStefan Fritsch <sf@apache.org>2013-03-23 16:12:52 +0000
commit829e2a12c2258cfaebb26ef311ed2d41ab5a553a (patch)
tree220f885a41cbfadc4209330e9de78869a00c85cf /util-misc/apr_reslist.c
parent5c100ea811811cc92bd8fbcaedcbcf58e3c7599c (diff)
downloadapr-829e2a12c2258cfaebb26ef311ed2d41ab5a553a.tar.gz
thread_pool/reslist: take ownership of the pool when we lock the mutex
(except in cases where there is no chance that the pool is used) git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1460183 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'util-misc/apr_reslist.c')
-rw-r--r--util-misc/apr_reslist.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/util-misc/apr_reslist.c b/util-misc/apr_reslist.c
index f44484935..ecc17a7d4 100644
--- a/util-misc/apr_reslist.c
+++ b/util-misc/apr_reslist.c
@@ -143,6 +143,7 @@ static apr_status_t reslist_cleanup(void *data_)
#if APR_HAS_THREADS
apr_thread_mutex_lock(rl->listlock);
+ apr_pool_owner_set(rl->pool, 0);
#endif
while (rl->nidle > 0) {
@@ -182,6 +183,7 @@ APR_DECLARE(apr_status_t) apr_reslist_maintain(apr_reslist_t *reslist)
#if APR_HAS_THREADS
apr_thread_mutex_lock(reslist->listlock);
+ apr_pool_owner_set(reslist->pool, 0);
#endif
/* Check if we need to create more resources, and if we are allowed to. */
@@ -332,6 +334,7 @@ APR_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist,
#if APR_HAS_THREADS
apr_thread_mutex_lock(reslist->listlock);
+ apr_pool_owner_set(reslist->pool, 0);
#endif
/* If there are idle resources on the available list, use
* them right away. */
@@ -412,6 +415,7 @@ APR_DECLARE(apr_status_t) apr_reslist_release(apr_reslist_t *reslist,
#if APR_HAS_THREADS
apr_thread_mutex_lock(reslist->listlock);
+ apr_pool_owner_set(reslist->pool, 0);
#endif
res = get_container(reslist);
res->opaque = resource;
@@ -436,6 +440,7 @@ APR_DECLARE(apr_uint32_t) apr_reslist_acquired_count(apr_reslist_t *reslist)
#if APR_HAS_THREADS
apr_thread_mutex_lock(reslist->listlock);
+ apr_pool_owner_set(reslist->pool, 0);
#endif
count = reslist->ntotal - reslist->nidle;
#if APR_HAS_THREADS
@@ -451,6 +456,7 @@ APR_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist,
apr_status_t ret;
#if APR_HAS_THREADS
apr_thread_mutex_lock(reslist->listlock);
+ apr_pool_owner_set(reslist->pool, 0);
#endif
ret = reslist->destructor(resource, reslist->params, reslist->pool);
reslist->ntotal--;