summaryrefslogtreecommitdiff
path: root/threadproc/netware/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'threadproc/netware/thread.c')
-rw-r--r--threadproc/netware/thread.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/threadproc/netware/thread.c b/threadproc/netware/thread.c
index 404b42f74..822d2e24f 100644
--- a/threadproc/netware/thread.c
+++ b/threadproc/netware/thread.c
@@ -24,7 +24,7 @@ static int thread_count = 0;
apr_status_t apr_threadattr_create(apr_threadattr_t **new,
apr_pool_t *pool)
{
- (*new) = (apr_threadattr_t *)apr_palloc(pool,
+ (*new) = (apr_threadattr_t *)apr_palloc(pool,
sizeof(apr_threadattr_t));
if ((*new) == NULL) {
@@ -41,7 +41,7 @@ apr_status_t apr_threadattr_create(apr_threadattr_t **new,
apr_status_t apr_threadattr_detach_set(apr_threadattr_t *attr,apr_int32_t on)
{
attr->detach = on;
- return APR_SUCCESS;
+ return APR_SUCCESS;
}
apr_status_t apr_threadattr_detach_get(apr_threadattr_t *attr)
@@ -64,6 +64,13 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
return APR_ENOTIMPL;
}
+APR_DECLARE(apr_status_t) apr_threadattr_max_free_set(apr_threadattr_t *attr,
+ apr_size_t size)
+{
+ attr->max_free = size;
+ return APR_SUCCESS;
+}
+
#if APR_HAS_THREAD_LOCAL
static APR_THREAD_LOCAL apr_thread_t *current_thread = NULL;
#endif
@@ -93,27 +100,22 @@ static apr_status_t alloc_thread(apr_thread_t **new,
{
apr_status_t stat;
apr_abortfunc_t abort_fn = apr_pool_abort_get(pool);
- apr_allocator_t *allocator;
apr_pool_t *p;
/* The thread can be detached anytime (from the creation or later with
* apr_thread_detach), so it needs its own pool and allocator to not
* depend on a parent pool which could be destroyed before the thread
* exits. The allocator needs no mutex obviously since the pool should
- * not be used nor create children pools outside the thread.
+ * not be used nor create children pools outside the thread. Passing
+ * NULL allocator will create one like that.
*/
- stat = apr_allocator_create(&allocator);
+ stat = apr_pool_create_unmanaged_ex(&p, abort_fn, NULL);
if (stat != APR_SUCCESS) {
- if (abort_fn)
- abort_fn(stat);
return stat;
}
- stat = apr_pool_create_unmanaged_ex(&p, abort_fn, allocator);
- if (stat != APR_SUCCESS) {
- apr_allocator_destroy(allocator);
- return stat;
+ if (attr && attr->max_free) {
+ apr_allocator_max_free_set(apr_pool_allocator_get(p), attr->max_free);
}
- apr_allocator_owner_set(allocator, p);
(*new) = (apr_thread_t *)apr_pcalloc(p, sizeof(apr_thread_t));
if ((*new) == NULL) {
@@ -263,7 +265,7 @@ void apr_thread_exit(apr_thread_t *thd, apr_status_t retval)
apr_status_t apr_thread_join(apr_status_t *retval,
apr_thread_t *thd)
{
- apr_status_t stat;
+ apr_status_t stat;
NXThreadId_t dthr;
if (thd->detached) {