You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by st...@apache.org on 2003/09/28 01:58:24 UTC

cvs commit: apr/misc/unix start.c

striker     2003/09/27 16:58:24

  Modified:    memory/unix Tag: APR_0_9_BRANCH apr_pools.c
               misc/unix Tag: APR_0_9_BRANCH start.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
  No                   revision
  No                   revision
  1.197.2.1 +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.197
  retrieving revision 1.197.2.1
  diff -u -r1.197 -r1.197.2.1
  --- apr_pools.c	18 Jul 2003 23:10:04 -0000	1.197
  +++ apr_pools.c	27 Sep 2003 23:58:23 -0000	1.197.2.1
  @@ -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);
  
  
  
  No                   revision
  No                   revision
  1.70.2.1  +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.70.2.1
  diff -u -r1.70 -r1.70.2.1
  --- start.c	6 Jan 2003 23:44:32 -0000	1.70
  +++ start.c	27 Sep 2003 23:58:23 -0000	1.70.2.1
  @@ -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);