From: Asanka Herath Date: Wed, 15 Jul 2009 15:23:42 +0000 (-0400) Subject: Use InterlockedExchangeAdd() instead of InterlockedAdd() on Windows X-Git-Tag: openafs-devel-1_5_61~107 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=00e32618c0f08f314e191655e373452891213ee5;p=packages%2Fo%2Fopenafs.git Use InterlockedExchangeAdd() instead of InterlockedAdd() on Windows InterlockedAdd() is not supported on all the platforms we wish to support. However, InterlockedExchangeAdd() is. The two functions are semantically similar with the exception that InterlockedExchangeAdd() returns the initial value of the object being modified while InterlockedAdd() returns the resulting value. Since the return value of the rx_MutexAdd() macro is unused, this is irrelevant. Reviewed-on: http://gerrit.openafs.org/98 Verified-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- diff --git a/src/rx/rx.h b/src/rx/rx.h index ba9537f16..5e2550bfc 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -1087,7 +1087,7 @@ typedef struct rx_interface_stat { extern int rx_DumpCalls(FILE *outputFile, char *cookie); #define rx_MutexIncrement(object, mutex) InterlockedIncrement(&object) -#define rx_MutexAdd(object, addend, mutex) InterlockedAdd(&object, addend) +#define rx_MutexAdd(object, addend, mutex) InterlockedExchangeAdd(&object, addend) #define rx_MutexDecrement(object, mutex) InterlockedDecrement(&object) #define rx_MutexAdd1Increment2(object1, addend, object2, mutex) \ do { \