jwoolley 2003/07/01 22:25:44
Modified: buckets apr_buckets_alloc.c
include apr_buckets.h
Log:
an addition to the api to allow httpd mpm's to share an apr_allocator_t
between a thread pool and the thread's bucket allocator. this will allow
the freelist max size to be managed.
Revision Changes Path
1.10 +9 -1 apr-util/buckets/apr_buckets_alloc.c
Index: apr_buckets_alloc.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_alloc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -u -r1.9 -r1.10
--- apr_buckets_alloc.c 1 Jan 2003 00:02:17 -0000 1.9
+++ apr_buckets_alloc.c 2 Jul 2003 05:25:44 -0000 1.10
@@ -90,10 +90,18 @@
APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create(apr_pool_t
*p)
{
apr_allocator_t *allocator;
+
+ apr_allocator_create(&allocator);
+ return apr_bucket_alloc_create_ex(p, allocator);
+}
+
+APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create_ex(
+ apr_pool_t *p,
+ apr_allocator_t *allocator)
+{
apr_bucket_alloc_t *list;
apr_memnode_t *block;
- apr_allocator_create(&allocator);
block = apr_allocator_alloc(allocator, ALLOC_AMT);
list = (apr_bucket_alloc_t *)block->first_avail;
list->pool = p;
1.151 +11 -1 apr-util/include/apr_buckets.h
Index: apr_buckets.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -u -r1.150 -r1.151
--- apr_buckets.h 13 Mar 2003 23:53:19 -0000 1.150
+++ apr_buckets.h 2 Jul 2003 05:25:44 -0000 1.151
@@ -921,13 +921,23 @@
/* ***** Bucket freelist functions ***** */
/**
- * Create a bucket allocator.
+ * Create a bucket allocator (and its underlying apr_allocator_t).
* @param p Pool to allocate the allocator from [note: this is only
* used to allocate internal structures of the allocator, NOT
* to allocate the memory handed out by the allocator]
* @warning The allocator must never be used by more than one thread at a
time.
*/
APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create(apr_pool_t
*p);
+
+/**
+ * Create a bucket allocator (specifying an apr_allocator_t for it to use).
+ * @param p Pool to allocate the allocator from [note: this is only
+ * used to allocate internal structures of the allocator,
NOT
+ * to allocate the memory handed out by the allocator]
+ * @param allocator The apr_allocator_t from which to get blocks of memory.
+ * @warning The allocator must never be used by more than one thread at a
time.
+ */
+APU_DECLARE_NONSTD(apr_bucket_alloc_t *)
apr_bucket_alloc_create_ex(apr_pool_t *p, apr_allocator_t *allocator);
/**
* Destroy a bucket allocator.