apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/atomic/win32 apr_atomic.c
Date Fri, 16 Apr 2004 13:54:19 GMT
wrowe       2004/04/16 06:54:19

  Modified:    atomic/win32 apr_atomic.c
  Log:
    Quiet build breakage on VC6 with the originally shipped includes
    (InterlockedCompareExchangePointer available in later SDK headers.)
  
    Few should be compiling on 64 bit cpu's under VC6 anymore, so ignore
    that edge case.
  
  Revision  Changes    Path
  1.4       +16 -5     apr/atomic/win32/apr_atomic.c
  
  Index: apr_atomic.c
  ===================================================================
  RCS file: /home/cvs/apr/atomic/win32/apr_atomic.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- apr_atomic.c	28 Feb 2004 18:31:41 -0000	1.3
  +++ apr_atomic.c	16 Apr 2004 13:54:19 -0000	1.4
  @@ -22,11 +22,6 @@
       return APR_SUCCESS;
   }
   
  -APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
  -{
  -    return InterlockedCompareExchangePointer(mem, with, cmp);
  -}
  -
   /* 
    * Remapping function pointer type to accept apr_uint32_t's type-safely
    * as the arguments for as our apr_atomic_foo32 Functions
  @@ -39,12 +34,18 @@
   typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_val_fn)
       (apr_uint32_t volatile *, 
        apr_uint32_t, apr_uint32_t);
  +typedef WINBASEAPI void * (WINAPI * apr_atomic_win32_ptr_ptr_ptr_fn)
  +    (volatile void **, 
  +     void *, const void *);
   
   APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
   {
       return ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, val);
   }
   
  +/* Of course we want the 2's compliment of the unsigned value, val */
  +#pragma warning(disable: 4146)
  +
   APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
   {
       ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, -val);
  @@ -75,6 +76,16 @@
                                              apr_uint32_t cmp)
   {
       return ((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem, with, cmp);
  +}
  +
  +APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
  +{
  +#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
  +    return InterlockedCompareExchangePointer(mem, with, cmp);
  +#else
  +    /* Too many VC6 users have stale win32 API files, stub this */
  +    return ((apr_atomic_win32_ptr_ptr_ptr_fn)InterlockedCompareExchange)(mem, with, cmp);
  +#endif
   }
   
   APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
  
  
  

Mime
View raw message