apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: apr/atomic/unix apr_atomic.c
Date Mon, 22 Apr 2002 01:49:47 GMT
jerenkrantz    02/04/21 18:49:47

  Modified:    atomic/unix apr_atomic.c
  Log:
  Style police are on the prowl.
  
  (No code changes)
  
  Revision  Changes    Path
  1.15      +13 -15    apr/atomic/unix/apr_atomic.c
  
  Index: apr_atomic.c
  ===================================================================
  RCS file: /home/cvs/apr/atomic/unix/apr_atomic.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- apr_atomic.c	19 Apr 2002 16:16:21 -0000	1.14
  +++ apr_atomic.c	22 Apr 2002 01:49:46 -0000	1.15
  @@ -52,29 +52,31 @@
    * <http://www.apache.org/>.
    */
   
  -
   #include "apr.h"
   #include "apr_atomic.h"
   #include "apr_thread_mutex.h"
   
   #if APR_HAS_THREADS
   
  -#if defined(APR_ATOMIC_NEED_DEFAULT)  || defined(APR_ATOMIC_NEED_CAS_DEFAULT)
  +#if defined(APR_ATOMIC_NEED_DEFAULT) || defined(APR_ATOMIC_NEED_CAS_DEFAULT)
   
   #define NUM_ATOMIC_HASH 7
   /* shift by 2 to get rid of alignment issues */
   #define ATOMIC_HASH(x) (unsigned int)(((unsigned long)(x)>>2)%(unsigned int)NUM_ATOMIC_HASH)
   static apr_thread_mutex_t **hash_mutex;
   
  -apr_status_t apr_atomic_init(apr_pool_t *p )
  +apr_status_t apr_atomic_init(apr_pool_t *p)
   {
       int i;
       apr_status_t rv;
  -    hash_mutex =apr_palloc(p,sizeof(apr_thread_mutex_t*) * NUM_ATOMIC_HASH);
  -    for (i=0;i<NUM_ATOMIC_HASH;i++) {
  -        rv = apr_thread_mutex_create(&(hash_mutex[i]), APR_THREAD_MUTEX_DEFAULT, p);
  -        if (rv != APR_SUCCESS)
  +    hash_mutex = apr_palloc(p, sizeof(apr_thread_mutex_t*) * NUM_ATOMIC_HASH);
  +
  +    for (i = 0; i < NUM_ATOMIC_HASH; i++) {
  +        rv = apr_thread_mutex_create(&(hash_mutex[i]),
  +                                     APR_THREAD_MUTEX_DEFAULT, p);
  +        if (rv != APR_SUCCESS) {
              return rv;
  +        }
       }
       return APR_SUCCESS;
   }
  @@ -90,10 +92,9 @@
           prev = *mem;
           *mem += val;
           apr_thread_mutex_unlock(lock);
  -/*        return prev; */
       }
  -/*    return *mem; */
   }
  +
   void apr_atomic_set(volatile apr_atomic_t *mem, apr_uint32_t val) 
   {
       apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
  @@ -103,12 +104,10 @@
           prev = *mem;
           *mem = val;
           apr_thread_mutex_unlock(lock);
  -/*        return prev; */
       }
  -/*    return *mem; */
   }
   
  -void apr_atomic_inc( volatile apr_uint32_t *mem) 
  +void apr_atomic_inc(volatile apr_uint32_t *mem) 
   {
       apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
       apr_uint32_t prev;
  @@ -117,10 +116,9 @@
           prev = *mem;
           (*mem)++;
           apr_thread_mutex_unlock(lock);
  -/*        return prev; */
       }
  -/*    return *mem; */
   }
  +
   int apr_atomic_dec(volatile apr_atomic_t *mem) 
   {
       apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
  @@ -138,7 +136,7 @@
   #endif /* APR_ATOMIC_NEED_DEFAULT */
   #if defined(APR_ATOMIC_NEED_CAS_DEFAULT)
   
  -apr_uint32_t apr_atomic_cas(volatile apr_uint32_t *mem,long with, long cmp)
  +apr_uint32_t apr_atomic_cas(volatile apr_uint32_t *mem, long with, long cmp)
   {
       apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
       long prev;
  
  
  

Mime
View raw message