[rtems-libbsd commit] atomic.h: Add atomic_load_long()
Sebastian Huber
sebh at rtems.org
Tue Aug 27 08:34:39 UTC 2019
Module: rtems-libbsd
Branch: master
Commit: 8bf5f93ac13b65da471c24b85262fd8b3e2f225a
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=8bf5f93ac13b65da471c24b85262fd8b3e2f225a
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Aug 27 09:50:05 2019 +0200
atomic.h: Add atomic_load_long()
---
rtemsbsd/include/machine/atomic.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/rtemsbsd/include/machine/atomic.h b/rtemsbsd/include/machine/atomic.h
index 347ea2e..a4b6b48 100644
--- a/rtemsbsd/include/machine/atomic.h
+++ b/rtemsbsd/include/machine/atomic.h
@@ -1478,6 +1478,27 @@ atomic_readandclear_long(volatile long *p)
}
static inline long
+atomic_load_long(volatile long *p)
+{
+ long tmp;
+
+#if defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_ATOMIC)
+ std::atomic_long *q =
+ reinterpret_cast<std::atomic_long *>(const_cast<long *>(p));
+
+ tmp = q->load(std::memory_order_relaxed);
+#elif defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_STDATOMIC)
+ atomic_long *q = (atomic_long *)RTEMS_DEVOLATILE(long *, p);
+
+ tmp = atomic_load_explicit(q, memory_order_relaxed);
+#else
+ tmp = *p;
+#endif
+
+ return (tmp);
+}
+
+static inline long
atomic_load_acq_long(volatile long *p)
{
long tmp;
More information about the vc
mailing list