apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject cvs commit: apr/memory/unix apr_sms.c apr_sms_blocks.c apr_sms_std.c apr_sms_tracking.c
Date Fri, 29 Jun 2001 18:29:46 GMT
dreid       01/06/29 11:29:45

  Modified:    include  apr_sms.h
               memory/unix apr_sms.c apr_sms_blocks.c apr_sms_std.c
                        apr_sms_tracking.c
  Log:
  We add another phase to the sms creation/initialisation that
  allows us to make calls that can/could use the sms and if we
  haven't finished initialising it, it'll segafult due to the lack
  of function pointers.
  
  This came up when trying to get pools running as sms :)
  
  Revision  Changes    Path
  1.18      +7 -0      apr/include/apr_sms.h
  
  Index: apr_sms.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_sms.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- apr_sms.h	2001/06/18 01:19:01	1.17
  +++ apr_sms.h	2001/06/29 18:29:40	1.18
  @@ -186,6 +186,13 @@
                                          apr_sms_t *parent_sms);
   
   /**
  + * Do post init work that needs the sms to have been fully
  + * initialised.
  + * @param sms The memory system to use
  + */
  +APR_DECLARE(apr_status_t) apr_sms_post_init(apr_sms_t *sms);
  +
  +/**
    * Check if a memory system is obeying all rules. 
    * @caution Call this function as the last statement before returning a new
    *          memory system from your apr_xxx_sms_create.
  
  
  
  1.27      +13 -4     apr/memory/unix/apr_sms.c
  
  Index: apr_sms.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_sms.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- apr_sms.c	2001/06/29 16:07:32	1.26
  +++ apr_sms.c	2001/06/29 18:29:42	1.27
  @@ -227,11 +227,20 @@
       /* XXX - This should eventually be removed */
       apr_pool_create(&sms->pool, pms ? pms->pool : NULL);
   
  -    /* Create the lock we'll use to protect cleanups and child lists */
  -    apr_lock_create(&sms->sms_lock, APR_MUTEX, APR_LOCKALL, NULL,
  -                    sms->pool);
  -
       return APR_SUCCESS;
  +}
  +
  +APR_DECLARE(apr_status_t) apr_sms_post_init(apr_sms_t *sms)
  +{
  +    /* We do things here as these may potentially make calls
  +     * to the sms that we're creating, and if we make the calls
  +     * in the sms_init phase we haven't yet added the function
  +     * pointers so we'll segfault!
  +     */
  +
  +    /* Create the sms framework lock we'll use. */
  +    return apr_lock_create(&sms->sms_lock, APR_MUTEX, APR_LOCKALL,
  +                           NULL, sms->pool);
   }
   
   #ifdef APR_ASSERT_MEMORY
  
  
  
  1.9       +1 -0      apr/memory/unix/apr_sms_blocks.c
  
  Index: apr_sms_blocks.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_sms_blocks.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- apr_sms_blocks.c	2001/06/21 11:33:54	1.8
  +++ apr_sms_blocks.c	2001/06/29 18:29:43	1.9
  @@ -273,6 +273,7 @@
       /* We are normally single threaded so no lock */
   
       apr_sms_assert(new_sms);
  +    apr_sms_post_init(new_sms);
   
       *sms = new_sms;
       return APR_SUCCESS;
  
  
  
  1.10      +1 -0      apr/memory/unix/apr_sms_std.c
  
  Index: apr_sms_std.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_sms_std.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- apr_sms_std.c	2001/06/10 14:45:32	1.9
  +++ apr_sms_std.c	2001/06/29 18:29:43	1.10
  @@ -133,6 +133,7 @@
        */
       
       apr_sms_assert(new_sms);
  +    apr_sms_post_init(new_sms);
   
       *sms = new_sms;
       return APR_SUCCESS;
  
  
  
  1.15      +1 -0      apr/memory/unix/apr_sms_tracking.c
  
  Index: apr_sms_tracking.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_sms_tracking.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- apr_sms_tracking.c	2001/06/18 20:24:13	1.14
  +++ apr_sms_tracking.c	2001/06/29 18:29:43	1.15
  @@ -291,6 +291,7 @@
                       new_sms->pool);
   
       apr_sms_assert(new_sms);
  +    apr_sms_post_init(new_sms);
   
       *sms = new_sms;
       return APR_SUCCESS;
  
  
  

Mime
View raw message