summaryrefslogtreecommitdiff
path: root/threadproc
diff options
context:
space:
mode:
authorsf <sf@13f79535-47bb-0310-9956-ffa450edef68>2013-03-23 16:12:00 +0000
committersf <sf@13f79535-47bb-0310-9956-ffa450edef68>2013-03-23 16:12:00 +0000
commit714bda5580cec37ab38db2483d6e324749e9cf77 (patch)
treed7528c0c5b50c11450b4d7f9d57aa60043fa7365 /threadproc
parent9ae1899baabe2c52094fd09cf70196f17d6107a3 (diff)
downloadlibapr-714bda5580cec37ab38db2483d6e324749e9cf77.tar.gz
Add apr_pool_owner_set function to allow use of pool debugging with threads
Actually this function has been mentioned in the docs for over 10 years but has never been implemented. Also consistently destroy the thread's pool when it exits normally, not only on apr_thread_exit(). This was already done on OS2. Other platforms than unix are untested. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1460182 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r--threadproc/beos/thread.c7
-rw-r--r--threadproc/netware/thread.c7
-rw-r--r--threadproc/os2/thread.c1
-rw-r--r--threadproc/unix/thread.c7
-rw-r--r--threadproc/win32/thread.c7
5 files changed, 25 insertions, 4 deletions
diff --git a/threadproc/beos/thread.c b/threadproc/beos/thread.c
index 8d8383942..01bc7a973 100644
--- a/threadproc/beos/thread.c
+++ b/threadproc/beos/thread.c
@@ -65,7 +65,12 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
static void *dummy_worker(void *opaque)
{
apr_thread_t *thd = (apr_thread_t*)opaque;
- return thd->func(thd, thd->data);
+ void *ret;
+
+ apr_pool_owner_set(thd->pool, 0);
+ ret = thd->func(thd, thd->data);
+ apr_pool_destroy(thd->pool);
+ return ret;
}
APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t *attr,
diff --git a/threadproc/netware/thread.c b/threadproc/netware/thread.c
index 82b846aaf..5e3d99d55 100644
--- a/threadproc/netware/thread.c
+++ b/threadproc/netware/thread.c
@@ -67,7 +67,12 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
static void *dummy_worker(void *opaque)
{
apr_thread_t *thd = (apr_thread_t *)opaque;
- return thd->func(thd, thd->data);
+ void *ret;
+
+ apr_pool_owner_set(thd->pool, 0);
+ ret = thd->func(thd, thd->data);
+ apr_pool_destroy(thd->pool);
+ return ret;
}
apr_status_t apr_thread_create(apr_thread_t **new,
diff --git a/threadproc/os2/thread.c b/threadproc/os2/thread.c
index e2cf3f6a8..9911034ae 100644
--- a/threadproc/os2/thread.c
+++ b/threadproc/os2/thread.c
@@ -69,6 +69,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
static void apr_thread_begin(void *arg)
{
apr_thread_t *thread = (apr_thread_t *)arg;
+ apr_pool_owner_set(thread->pool, 0);
thread->exitval = thread->func(thread, thread->data);
apr_pool_destroy(thread->pool);
}
diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c
index 5639ac706..6fc949f83 100644
--- a/threadproc/unix/thread.c
+++ b/threadproc/unix/thread.c
@@ -139,7 +139,12 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
static void *dummy_worker(void *opaque)
{
apr_thread_t *thread = (apr_thread_t*)opaque;
- return thread->func(thread, thread->data);
+ void *ret;
+
+ apr_pool_owner_set(thread->pool, 0);
+ ret = thread->func(thread, thread->data);
+ apr_pool_destroy(thread->pool);
+ return ret;
}
APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
diff --git a/threadproc/win32/thread.c b/threadproc/win32/thread.c
index 9b9473ad5..c713e1444 100644
--- a/threadproc/win32/thread.c
+++ b/threadproc/win32/thread.c
@@ -75,8 +75,13 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
static void *dummy_worker(void *opaque)
{
apr_thread_t *thd = (apr_thread_t *)opaque;
+ void *ret;
+
TlsSetValue(tls_apr_thread, thd->td);
- return thd->func(thd, thd->data);
+ apr_pool_owner_set(thd->pool, 0);
+ ret = thd->func(thd, thd->data);
+ apr_pool_destroy(thd->pool);
+ return ret;
}
APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,