striker 2003/09/27 16:51:46
Modified: misc/unix start.c
memory/unix apr_pools.c
Log:
* misc/unix/start.c
(apr_initialize): Remove atomics initialization from this function. Due
to circular dependency, doing it here is too late.
* memory/unix/apr_pools.c
(apr_pool_initialize): Add atomics initialization to the release and debug
versions. This has to happen here, since pools rely on mutexes, which
can be backed by atomics. Atomics initialization requires a pool.
Revision Changes Path
1.71 +6 -3 apr/misc/unix/start.c
Index: start.c
===================================================================
RCS file: /home/cvs/apr/misc/unix/start.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- start.c 6 Jan 2003 23:44:32 -0000 1.70
+++ start.c 27 Sep 2003 23:51:46 -0000 1.71
@@ -99,9 +99,12 @@
apr_pool_tag(pool, "apr_initialize");
- if ((status = apr_atomic_init(pool)) != APR_SUCCESS) {
- return status;
- }
+ /* apr_atomic_init() used to be called from here aswell.
+ * Pools rely on mutexes though, which can be backed by
+ * atomics. Due to this circular dependency
+ * apr_pool_initialize() is taking care of calling
+ * apr_atomic_init() at the correct time.
+ */
apr_signal_init(pool);
1.199 +14 -0 apr/memory/unix/apr_pools.c
Index: apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -r1.198 -r1.199
--- apr_pools.c 3 Sep 2003 17:12:18 -0000 1.198
+++ apr_pools.c 27 Sep 2003 23:51:46 -0000 1.199
@@ -555,6 +555,13 @@
apr_pool_tag(global_pool, "apr_global_pool");
+ /* This has to happen here because mutexes might be backed by
+ * atomics. It used to be snug and safe in apr_initialize().
+ */
+ if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) {
+ return rv;
+ }
+
#if APR_HAS_THREADS
{
apr_thread_mutex_t *mutex;
@@ -1265,6 +1272,13 @@
apr_pool_tag(global_pool, "APR global pool");
apr_pools_initialized = 1;
+
+ /* This has to happen here because mutexes might be backed by
+ * atomics. It used to be snug and safe in apr_initialize().
+ */
+ if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) {
+ return rv;
+ }
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
apr_file_open_stderr(&file_stderr, global_pool);