RCU: implement dereference and assign pointer
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Oct 2022 16:25:11 +0000 (12:25 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Oct 2022 16:25:11 +0000 (12:25 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/rcu.h

index be01cb7dd31dedd1205fdc511898ef10cea49307..74026b439d3df1e77a4bfc7d391ba0185c765c04 100644 (file)
--- a/src/rcu.h
+++ b/src/rcu.h
@@ -60,6 +60,15 @@ void side_rcu_read_end(struct side_rcu_gp_state *gp_state, unsigned int period)
        (void) __atomic_add_fetch(&gp_state->percpu_state[cpu].count[period].end, 1, __ATOMIC_RELEASE);
 }
 
+#define side_rcu_dereference(p) \
+       __extension__ \
+       ({ \
+               (__typeof__(p) _____side_v = __atomic_load_n(&(p), __ATOMIC_CONSUME); \
+               (_____side_v); \
+       })
+
+#define side_rcu_assign_pointer(p, v)  __atomic_store_n(&(p), v, __ATOMIC_RELEASE); \
+
 static inline
 void wait_for_cpus(struct side_rcu_gp_state *gp_state)
 {
This page took 0.024966 seconds and 4 git commands to generate.