apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: apr/locks/unix proc_mutex.c
Date Wed, 20 Nov 2002 21:11:43 GMT
rbb         2002/11/20 13:11:43

  Modified:    include  apr_proc_mutex.h
               include/arch/unix proc_mutex.h
               locks/unix proc_mutex.c
  Log:
  Register the proc_mutex cleanup with an exported API.  Most of this
  change is just a name change to make it very obvious what is happening.
  
  Revision  Changes    Path
  1.10      +8 -0      apr/include/apr_proc_mutex.h
  
  Index: apr_proc_mutex.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_proc_mutex.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- apr_proc_mutex.h	10 Nov 2002 08:35:16 -0000	1.9
  +++ apr_proc_mutex.h	20 Nov 2002 21:11:43 -0000	1.10
  @@ -163,6 +163,14 @@
   APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex);
   
   /**
  + * Destroy the mutex and free the memory associated with the lock.
  + * @param mutex the mutex to destroy.
  + * @note This function is generally used to kill a cleanup on an already
  + *       created mutex
  + */
  +APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex);
  +
  +/**
    * Display the name of the mutex, as it relates to the actual method used.
    * This matches the valid options for Apache's AcceptMutex directive
    * @param mutex the name of the mutex
  
  
  
  1.11      +1 -1      apr/include/arch/unix/proc_mutex.h
  
  Index: proc_mutex.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/proc_mutex.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- proc_mutex.h	18 Nov 2002 01:59:03 -0000	1.10
  +++ proc_mutex.h	20 Nov 2002 21:11:43 -0000	1.11
  @@ -111,7 +111,7 @@
       apr_status_t (*acquire)(apr_proc_mutex_t *);
       apr_status_t (*tryacquire)(apr_proc_mutex_t *);
       apr_status_t (*release)(apr_proc_mutex_t *);
  -    apr_status_t (*destroy)(apr_proc_mutex_t *);
  +    apr_status_t (*cleanup)(void *);
       apr_status_t (*child_init)(apr_proc_mutex_t **, apr_pool_t *, const char *);
       const char *name;
   };
  
  
  
  1.21      +18 -23    apr/locks/unix/proc_mutex.c
  
  Index: proc_mutex.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/proc_mutex.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- proc_mutex.c	18 Nov 2002 01:59:03 -0000	1.20
  +++ proc_mutex.c	20 Nov 2002 21:11:43 -0000	1.21
  @@ -63,6 +63,12 @@
   #define SEM_FAILED (-1)
   #endif
   
  +static apr_status_t proc_mutex_destroy(apr_proc_mutex_t *mutex)
  +{
  +    return apr_pool_cleanup_run(mutex->pool, mutex, apr_proc_mutex_cleanup);
  +}
  +
  +
   static void proc_mutex_posix_setup(void)
   {
   }
  @@ -122,7 +128,7 @@
       sem_unlink((const char *) semname);
       new_mutex->interproc->filedes = (int)psem;	/* Ugg */
       apr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex,
  -                              proc_mutex_posix_cleanup, 
  +                              apr_proc_mutex_cleanup, 
                                 apr_pool_cleanup_null);
       return APR_SUCCESS;
   }
  @@ -149,17 +155,6 @@
       return APR_SUCCESS;
   }
   
  -static apr_status_t proc_mutex_posix_destroy(apr_proc_mutex_t *mutex)
  -{
  -    apr_status_t stat;
  -
  -    if ((stat = proc_mutex_posix_cleanup(mutex)) == APR_SUCCESS) {
  -        apr_pool_cleanup_kill(mutex->pool, mutex, proc_mutex_posix_cleanup);
  -        return APR_SUCCESS;
  -    }
  -    return stat;
  -}
  -
   static apr_status_t proc_mutex_posix_child_init(apr_proc_mutex_t **mutex,
                                                   apr_pool_t *cont,
                                                   const char *fname)
  @@ -178,7 +173,7 @@
       proc_mutex_posix_acquire,
       NULL, /* no tryacquire */
       proc_mutex_posix_release,
  -    proc_mutex_posix_destroy,
  +    proc_mutex_posix_cleanup,
       proc_mutex_posix_child_init,
       "posixsem"
   };
  @@ -234,7 +229,7 @@
       }
       new_mutex->curr_locked = 0;
       apr_pool_cleanup_register(new_mutex->pool,
  -                              (void *)new_mutex, proc_mutex_sysv_cleanup, 
  +                              (void *)new_mutex, apr_proc_mutex_cleanup, 
                                 apr_pool_cleanup_null);
       return APR_SUCCESS;
   }
  @@ -294,7 +289,7 @@
       proc_mutex_sysv_acquire,
       NULL, /* no tryacquire */
       proc_mutex_sysv_release,
  -    proc_mutex_sysv_destroy,
  +    proc_mutex_sysv_cleanup,
       proc_mutex_sysv_child_init,
       "sysvsem"
   };
  @@ -399,7 +394,7 @@
       new_mutex->curr_locked = 0;
       apr_pool_cleanup_register(new_mutex->pool,
                                 (void *)new_mutex,
  -                              proc_mutex_proc_pthread_cleanup, 
  +                              apr_proc_mutex_cleanup, 
                                 apr_pool_cleanup_null);
       return APR_SUCCESS;
   }
  @@ -469,7 +464,7 @@
       proc_mutex_proc_pthread_acquire,
       NULL, /* no tryacquire */
       proc_mutex_proc_pthread_release,
  -    proc_mutex_proc_pthread_destroy,
  +    proc_mutex_proc_pthread_cleanup,
       proc_mutex_proc_pthread_child_init,
       "pthread"
   };
  @@ -544,7 +539,7 @@
       unlink(new_mutex->fname);
       apr_pool_cleanup_register(new_mutex->pool,
                                 (void*)new_mutex,
  -                              proc_mutex_fcntl_cleanup, 
  +                              apr_proc_mutex_cleanup, 
                                 apr_pool_cleanup_null);
       return APR_SUCCESS; 
   }
  @@ -605,7 +600,7 @@
       proc_mutex_fcntl_acquire,
       NULL, /* no tryacquire */
       proc_mutex_fcntl_release,
  -    proc_mutex_fcntl_destroy,
  +    proc_mutex_fcntl_cleanup,
       proc_mutex_fcntl_child_init,
       "fcntl"
   };
  @@ -659,7 +654,7 @@
       }
       new_mutex->curr_locked = 0;
       apr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex,
  -                              proc_mutex_flock_cleanup,
  +                              apr_proc_mutex_cleanup,
                                 apr_pool_cleanup_null);
       return APR_SUCCESS;
   }
  @@ -735,7 +730,7 @@
       proc_mutex_flock_acquire,
       NULL, /* no tryacquire */
       proc_mutex_flock_release,
  -    proc_mutex_flock_destroy,
  +    proc_mutex_flock_cleanup,
       proc_mutex_flock_child_init,
       "flock"
   };
  @@ -895,9 +890,9 @@
       return mutex->meth->release(mutex);
   }
   
  -APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex)
  +APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex)
   {
  -    return mutex->meth->destroy(mutex);
  +    return ((apr_proc_mutex_t *)mutex)->meth->cleanup(mutex);
   }
   
   APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
  
  
  

Mime
View raw message