You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by pq...@apache.org on 2008/10/30 11:45:45 UTC
svn commit: r709135 - /apr/apr-util/trunk/misc/apr_thread_pool.c
Author: pquerna
Date: Thu Oct 30 03:45:44 2008
New Revision: 709135
URL: http://svn.apache.org/viewvc?rev=709135&view=rev
Log:
* misc/apr_thread_pool.c
(apr_thread_pool_create): Only set the output variable if we were successful.
Modified:
apr/apr-util/trunk/misc/apr_thread_pool.c
Modified: apr/apr-util/trunk/misc/apr_thread_pool.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/misc/apr_thread_pool.c?rev=709135&r1=709134&r2=709135&view=diff
==============================================================================
--- apr/apr-util/trunk/misc/apr_thread_pool.c (original)
+++ apr/apr-util/trunk/misc/apr_thread_pool.c Thu Oct 30 03:45:44 2008
@@ -362,33 +362,36 @@
{
apr_thread_t *t;
apr_status_t rv = APR_SUCCESS;
+ apr_thread_pool_t *tp;
- *me = apr_pcalloc(pool, sizeof(**me));
- if (!*me) {
- return APR_ENOMEM;
- }
+ *me = NULL;
+ tp = apr_pcalloc(pool, sizeof(apr_thread_pool_t));
- (*me)->pool = pool;
+ tp->pool = pool;
- rv = thread_pool_construct(*me, init_threads, max_threads);
+ rv = thread_pool_construct(tp, init_threads, max_threads);
if (APR_SUCCESS != rv) {
- *me = NULL;
return rv;
}
- apr_pool_cleanup_register(pool, *me, thread_pool_cleanup,
+ apr_pool_cleanup_register(pool, tp, thread_pool_cleanup,
apr_pool_cleanup_null);
while (init_threads) {
- rv = apr_thread_create(&t, NULL, thread_pool_func, *me, (*me)->pool);
+ rv = apr_thread_create(&t, NULL, thread_pool_func, tp, tp->pool);
if (APR_SUCCESS != rv) {
break;
}
- ++(*me)->thd_cnt;
- if ((*me)->thd_cnt > (*me)->thd_high)
- (*me)->thd_high = (*me)->thd_cnt;
+ tp->thd_cnt++;
+ if (tp->thd_cnt > tp->thd_high) {
+ tp->thd_high = tp->thd_cnt;
+ }
--init_threads;
}
+ if (rv == APR_SUCCESS) {
+ *me = tp;
+ }
+
return rv;
}