diff options
author | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 2000-12-31 18:04:59 +0000 |
---|---|---|
committer | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 2000-12-31 18:04:59 +0000 |
commit | 5296d3a23c0d72e25babb5583022d967c6e25a1d (patch) | |
tree | 70826f2043746d9a69f5672a20916d48b9271b67 /misc | |
parent | 738306c3aec80624d3f511762b32176a17a23866 (diff) | |
download | libapr-5296d3a23c0d72e25babb5583022d967c6e25a1d.tar.gz |
Begin to remove the ability to allocate out of NULL pools. The first
problem to solve, is that we need an apr_lock in order to allocate
pools, so that we can lock things out when allocating. So, how do we
allocate locks without a pool to allocate from? The answer is to create
a global_apr_pool, which is a bootstrapping pool. There should NEVER
be a sub-pool off this pool, and it is static to an APR file. This is
only used to allow us to allocate the locks cleanly, without using the
NULL pool hack.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60997 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc')
-rw-r--r-- | misc/unix/start.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/misc/unix/start.c b/misc/unix/start.c index 04371d6e1..0cd81cd87 100644 --- a/misc/unix/start.c +++ b/misc/unix/start.c @@ -61,7 +61,7 @@ static int initialized = 0; - +static apr_pool_t *global_apr_pool; apr_status_t apr_initialize(void) { @@ -76,6 +76,10 @@ apr_status_t apr_initialize(void) return APR_SUCCESS; } + if (apr_create_pool(&global_apr_pool, NULL) != APR_SUCCESS) { + return APR_ENOPOOL; + } + #if !defined(BEOS) && !defined(OS2) && !defined(WIN32) apr_unix_setup_lock(); #elif defined WIN32 @@ -90,7 +94,7 @@ apr_status_t apr_initialize(void) return APR_EEXIST; } #endif - status = apr_init_alloc(); + status = apr_init_alloc(global_apr_pool); return status; } @@ -100,7 +104,7 @@ void apr_terminate(void) if (initialized) { return; } - apr_term_alloc(); + apr_term_alloc(global_apr_pool); } apr_status_t apr_set_abort(int (*apr_abort)(int retcode), apr_pool_t *cont) |