1 Star 0 Fork 25

fly_fzc/apr

forked from src-openEuler/apr 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Split-apr_pool_check_integrity-into-two-parts.patch 2.92 KB
一键复制 编辑 原始数据 按行查看 历史
dogsheng 提交于 2019-12-25 15:41 . Package init
From 68710d39de65fa4f16c890110342a249f60a66fa Mon Sep 17 00:00:00 2001
From: Rainer Jung <rjung@apache.org>
Date: Wed, 17 Jul 2019 11:41:21 +0000
Subject: [PATCH 02/10] Split apr_pool_check_integrity() into two parts
Run the pool owner check part only after pre-cleanups have been run, in
order to give them a chance to kill of any threads that may still be
accessing the pool.
Backport of r1460184 from trunk resp. r1863199 from 1.7.x.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1863208 13f79535-47bb-0310-9956-ffa450edef68
---
memory/unix/apr_pools.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index 3361f7a7d..614919ede 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -1594,7 +1594,7 @@ static int apr_pool_is_child_of(apr_pool_t *pool, apr_pool_t *parent)
}
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_LIFETIME) */
-static void apr_pool_check_integrity(apr_pool_t *pool)
+static void apr_pool_check_lifetime(apr_pool_t *pool)
{
/* Rule of thumb: use of the global pool is always
* ok, since the only user is apr_pools.c. Unless
@@ -1618,7 +1618,10 @@ static void apr_pool_check_integrity(apr_pool_t *pool)
abort();
}
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_LIFETIME) */
+}
+static void apr_pool_check_owner(apr_pool_t *pool)
+{
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_OWNER)
#if APR_HAS_THREADS
if (!apr_os_thread_equal(pool->owner, apr_os_thread_current())) {
@@ -1632,6 +1635,11 @@ static void apr_pool_check_integrity(apr_pool_t *pool)
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_OWNER) */
}
+static void apr_pool_check_integrity(apr_pool_t *pool)
+{
+ apr_pool_check_lifetime(pool);
+ apr_pool_check_owner(pool);
+}
/*
* Initialization (debug)
@@ -1820,6 +1828,12 @@ static void pool_clear_debug(apr_pool_t *pool, const char *file_line)
run_cleanups(&pool->pre_cleanups);
pool->pre_cleanups = NULL;
+ /*
+ * Now that we have given the pre cleanups the chance to kill of any
+ * threads using the pool, the owner must be correct.
+ */
+ apr_pool_check_owner(pool);
+
/* Destroy the subpools. The subpools will detach themselves from
* this pool thus this loop is safe and easy.
*/
@@ -1868,7 +1882,7 @@ APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *pool,
apr_thread_mutex_t *mutex = NULL;
#endif
- apr_pool_check_integrity(pool);
+ apr_pool_check_lifetime(pool);
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
apr_pool_log_event(pool, "CLEAR", file_line, 1);
@@ -1906,7 +1920,7 @@ APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *pool,
static void pool_destroy_debug(apr_pool_t *pool, const char *file_line)
{
- apr_pool_check_integrity(pool);
+ apr_pool_check_lifetime(pool);
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
apr_pool_log_event(pool, "DESTROY", file_line, 1);
--
2.19.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fly_fzc/apr.git
git@gitee.com:fly_fzc/apr.git
fly_fzc
apr
apr
master

搜索帮助