apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aa...@apache.org
Subject cvs commit: apr/locks/unix global_mutex.c
Date Mon, 18 Feb 2002 02:20:07 GMT
aaron       02/02/17 18:20:07

  Modified:    include/arch/unix global_mutex.h
               locks/unix global_mutex.c
  Log:
  Make apr_global_mutex_t work on systems w/o APR_HAS_THREADS.
  If you don't have threads, you don't need to use cross-thread
  mutual exclusion, so this becomes essentially apr_proc_mutex_t.
  
  Revision  Changes    Path
  1.2       +2 -0      apr/include/arch/unix/global_mutex.h
  
  Index: global_mutex.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/global_mutex.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- global_mutex.h	18 Feb 2002 01:16:03 -0000	1.1
  +++ global_mutex.h	18 Feb 2002 02:20:07 -0000	1.2
  @@ -66,7 +66,9 @@
   struct apr_global_mutex_t {
       apr_pool_t *pool;
       apr_proc_mutex_t *proc_mutex;
  +#if APR_HAS_THREADS
       apr_thread_mutex_t *thread_mutex;
  +#endif /* APR_HAS_THREADS */
   };
   
   #endif  /* GLOBAL_MUTEX_H */
  
  
  
  1.2       +10 -2     apr/locks/unix/global_mutex.c
  
  Index: global_mutex.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/global_mutex.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- global_mutex.c	18 Feb 2002 01:16:04 -0000	1.1
  +++ global_mutex.c	18 Feb 2002 02:20:07 -0000	1.2
  @@ -58,18 +58,19 @@
   #include "apr_proc_mutex.h"
   #include "apr_thread_mutex.h"
   
  -
   static apr_status_t global_mutex_cleanup(void *data)
   {
       apr_global_mutex_t *m = (apr_global_mutex_t *)data;
       apr_status_t rv;
   
  +#if APR_HAS_THREADS
       if (m->thread_mutex) {
           rv = apr_thread_mutex_destroy(m->thread_mutex);
           if (rv != APR_SUCCESS) {
               return rv;
           }
       }
  +#endif /* APR_HAS_THREADS */
       rv = apr_proc_mutex_destroy(m->proc_mutex);
       if (rv != APR_SUCCESS) {
          return rv;
  @@ -93,6 +94,7 @@
           return rv;
       }
   
  +#if APR_HAS_THREADS
       if (m->proc_mutex->inter_meth->flags & APR_PROCESS_LOCK_MECH_IS_GLOBAL)
{
           m->thread_mutex = NULL; /* We don't need a thread lock. */
       }
  @@ -103,6 +105,7 @@
               return rv;
           }
       }
  +#endif /* APR_HAS_THREADS */
   
       apr_pool_cleanup_register(m->pool, (void *)m,
                                 global_mutex_cleanup, apr_pool_cleanup_null);
  @@ -122,12 +125,14 @@
   {
       apr_status_t rv;
   
  +#if APR_HAS_THREADS
       if (mutex->thread_mutex) {
           rv = apr_thread_mutex_lock(mutex->thread_mutex);
           if (rv != APR_SUCCESS) {
               return rv;
           }
       }
  +#endif /* APR_HAS_THREADS */
       rv = apr_proc_mutex_lock(mutex->proc_mutex);
       if (rv != APR_SUCCESS) {
           return rv;
  @@ -139,12 +144,14 @@
   {
       apr_status_t rv;
   
  +#if APR_HAS_THREADS
       if (mutex->thread_mutex) {
           rv = apr_thread_mutex_trylock(mutex->thread_mutex);
           if (rv != APR_SUCCESS) {
               return rv;
           }
       }
  +#endif /* APR_HAS_THREADS */
       rv = apr_proc_mutex_trylock(mutex->proc_mutex);
       if (rv != APR_SUCCESS) {
           return rv;
  @@ -160,12 +167,14 @@
       if (rv != APR_SUCCESS) {
           return rv;
       }
  +#if APR_HAS_THREADS
       if (mutex->thread_mutex) {
           rv = apr_thread_mutex_unlock(mutex->thread_mutex);
           if (rv != APR_SUCCESS) {
               return rv;
           }
       }
  +#endif /* APR_HAS_THREADS */
       return APR_SUCCESS;
   }
   
  @@ -175,4 +184,3 @@
   }
   
   APR_POOL_IMPLEMENT_ACCESSOR(global_mutex);
  -
  
  
  

Mime
View raw message