You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/04/25 15:17:08 UTC
svn commit: r1330268 -
/subversion/trunk/subversion/libsvn_subr/named_atomic.c
Author: danielsh
Date: Wed Apr 25 13:17:07 2012
New Revision: 1330268
URL: http://svn.apache.org/viewvc?rev=1330268&view=rev
Log:
Follow-up to r1326337: avoid a macro name clash.
* subversion/libsvn_subr/named_atomic.c
(SYNCHRONIZE, SYNCHRONIZE_IS_FAST): Rename to..
(NA_SYNCHRONIZE, NA_SYNCHRONIZE_IS_FAST): .. these, respectively.
(*): Update references.
Modified:
subversion/trunk/subversion/libsvn_subr/named_atomic.c
Modified: subversion/trunk/subversion/libsvn_subr/named_atomic.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/named_atomic.c?rev=1330268&r1=1330267&r2=1330268&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/named_atomic.c (original)
+++ subversion/trunk/subversion/libsvn_subr/named_atomic.c Wed Apr 25 13:17:07 2012
@@ -84,16 +84,13 @@
*/
#define SHM_NAME_SUFFIX "Shm"
-/* Prevent macro re-definition warning (on Windows in particular).
- */
-#ifdef SYNCHRONIZE
-#undef SYNCHRONIZE
-#endif
-
/* Platform-dependent implementations of our basic atomic operations.
- * SYNCHRONIZE(op) will ensure that the OP gets executed atomically.
+ * NA_SYNCHRONIZE(op) will ensure that the OP gets executed atomically.
* This will be zero-overhead if OP itself is already atomic.
*
+ * (We don't call it SYNCHRONIZE because Windows has a preprocess macro by
+ * that name.)
+ *
* The default implementation will use the same mutex for initialization
* as well as any type of data access. This is quite expensive and we
* can do much better on most platforms.
@@ -108,8 +105,8 @@
#define synched_cmpxchg(mem, value, comperand) \
InterlockedCompareExchange64(mem, value, comperand)
-#define SYNCHRONIZE(_atomic,op) op;
-#define SYNCHRONIZE_IS_FAST TRUE
+#define NA_SYNCHRONIZE(_atomic,op) op;
+#define NA_SYNCHRONIZE_IS_FAST TRUE
#elif SVN_HAS_ATOMIC_BUILTINS
@@ -121,8 +118,8 @@
#define synched_cmpxchg(mem, value, comperand) \
__sync_val_compare_and_swap(mem, comperand, value)
-#define SYNCHRONIZE(_atomic,op) op;
-#define SYNCHRONIZE_IS_FAST TRUE
+#define NA_SYNCHRONIZE(_atomic,op) op;
+#define NA_SYNCHRONIZE_IS_FAST TRUE
#else
@@ -161,12 +158,12 @@ synched_cmpxchg(volatile apr_int64_t *me
return old_value;
}
-#define SYNCHRONIZE(_atomic,op)\
+#define NA_SYNCHRONIZE(_atomic,op)\
SVN_ERR(lock(_atomic->mutex));\
op;\
SVN_ERR(unlock(_atomic->mutex,SVN_NO_ERROR));
-#define SYNCHRONIZE_IS_FAST FALSE
+#define NA_SYNCHRONIZE_IS_FAST FALSE
#endif
@@ -346,7 +343,7 @@ return_atomic(svn_named_atomic__t **atom
svn_boolean_t
svn_named_atomic__is_efficient(void)
{
- return SYNCHRONIZE_IS_FAST;
+ return NA_SYNCHRONIZE_IS_FAST;
}
svn_error_t *
@@ -518,7 +515,7 @@ svn_named_atomic__read(apr_int64_t *valu
svn_named_atomic__t *atomic)
{
SVN_ERR(validate(atomic));
- SYNCHRONIZE(atomic, *value = synched_read(&atomic->data->value));
+ NA_SYNCHRONIZE(atomic, *value = synched_read(&atomic->data->value));
return SVN_NO_ERROR;
}
@@ -531,7 +528,7 @@ svn_named_atomic__write(apr_int64_t *old
apr_int64_t temp;
SVN_ERR(validate(atomic));
- SYNCHRONIZE(atomic, temp = synched_write(&atomic->data->value, new_value));
+ NA_SYNCHRONIZE(atomic, temp = synched_write(&atomic->data->value, new_value));
if (old_value)
*old_value = temp;
@@ -547,7 +544,7 @@ svn_named_atomic__add(apr_int64_t *new_v
apr_int64_t temp;
SVN_ERR(validate(atomic));
- SYNCHRONIZE(atomic, temp = synched_add(&atomic->data->value, delta));
+ NA_SYNCHRONIZE(atomic, temp = synched_add(&atomic->data->value, delta));
if (new_value)
*new_value = temp;
@@ -564,9 +561,9 @@ svn_named_atomic__cmpxchg(apr_int64_t *o
apr_int64_t temp;
SVN_ERR(validate(atomic));
- SYNCHRONIZE(atomic, temp = synched_cmpxchg(&atomic->data->value,
- new_value,
- comperand));
+ NA_SYNCHRONIZE(atomic, temp = synched_cmpxchg(&atomic->data->value,
+ new_value,
+ comperand));
if (old_value)
*old_value = temp;