aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-03-21 21:17:43 -0700
committerDamjan Marion <dmarion@me.com>2019-03-22 17:30:17 +0000
commit881d13ede7336e5b16601033e5dd9aeb94c795e3 (patch)
tree7450066ca6d1bbbbd4d98dff3639da1d4482e170 /src
parentb757d1a7f5800b303ea930c6b1ae6224f463de3a (diff)
svm/atomics: add clib_atomic_swap_rel_n
Change-Id: Iea2c173000570043beafef58ca923463ce76d872 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/svm/svm_fifo.h4
-rw-r--r--src/vppinfra/atomics.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h
index 6c3940dfad5..59d7ee01c8e 100644
--- a/src/svm/svm_fifo.h
+++ b/src/svm/svm_fifo.h
@@ -173,7 +173,7 @@ svm_fifo_set_event (svm_fifo_t * f)
{
/* return __sync_lock_test_and_set (&f->has_event, 1) == 0;
return __sync_bool_compare_and_swap (&f->has_event, 0, 1); */
- return !__atomic_exchange_n (&f->has_event, 1, __ATOMIC_RELEASE);
+ return !clib_atomic_swap_rel_n (&f->has_event, 1);
}
/**
@@ -184,7 +184,7 @@ svm_fifo_set_event (svm_fifo_t * f)
always_inline void
svm_fifo_unset_event (svm_fifo_t * f)
{
- __atomic_exchange_n (&f->has_event, 0, __ATOMIC_ACQUIRE);
+ clib_atomic_swap_acq_n (&f->has_event, 0);
}
svm_fifo_t *svm_fifo_create (u32 data_size_in_bytes);
diff --git a/src/vppinfra/atomics.h b/src/vppinfra/atomics.h
index 8084bdc77d4..6fe3af27d97 100644
--- a/src/vppinfra/atomics.h
+++ b/src/vppinfra/atomics.h
@@ -43,6 +43,7 @@
#define clib_atomic_load_acq_n(a) __atomic_load_n((a), __ATOMIC_ACQUIRE)
#define clib_atomic_store_rel_n(a, b) __atomic_store_n ((a), (b), __ATOMIC_RELEASE)
#define clib_atomic_swap_acq_n(a, b) __atomic_exchange_n ((a), (b), __ATOMIC_ACQUIRE)
+#define clib_atomic_swap_rel_n(a, b) __atomic_exchange_n ((a), (b), __ATOMIC_RELEASE)
#define clib_atomic_fetch_add_rel(a, b) __atomic_fetch_add((a), (b), __ATOMIC_RELEASE)
#define clib_atomic_fetch_sub_rel(a, b) __atomic_fetch_sub((a), (b), __ATOMIC_RELEASE)