projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup: move generic caa_get_cycles to arch/generic.h
[urcu.git]
/
urcu
/
static
/
urcu-pointer.h
diff --git
a/urcu/static/urcu-pointer.h
b/urcu/static/urcu-pointer.h
index acd7cee1f0677554794f238e945715e1e4bd3b10..06371e3dd1c066387db5316087346ccf9bbdf80b 100644
(file)
--- a/
urcu/static/urcu-pointer.h
+++ b/
urcu/static/urcu-pointer.h
@@
-6,8
+6,8
@@
*
* Userspace RCU header. Operations on pointers.
*
*
* Userspace RCU header. Operations on pointers.
*
- * TO BE INCLUDED ONLY IN
LGPL-COMPATIBLE CODE. See urcu-pointer.h for
- * linking dynamically with the userspace rcu library.
+ * TO BE INCLUDED ONLY IN
CODE THAT IS TO BE RECOMPILED ON EACH LIBURCU
+ *
RELEASE. See urcu.h for
linking dynamically with the userspace rcu library.
*
* Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
*
* Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* Copyright (c) 2009 Paul E. McKenney, IBM Corporation.
@@
-59,10
+59,15
@@
extern "C" {
* addition to forthcoming C++ standard.
*
* Should match rcu_assign_pointer() or rcu_xchg_pointer().
* addition to forthcoming C++ standard.
*
* Should match rcu_assign_pointer() or rcu_xchg_pointer().
+ *
+ * This macro is less than 10 lines long. The intent is that this macro
+ * meets the 10-line criterion in LGPL, allowing this function to be
+ * expanded directly in non-LGPL code.
*/
*/
-
-#define _rcu_dereference(p) ({ \
- typeof(p) _________p1 = CMM_LOAD_SHARED(p); \
+#define _rcu_dereference(p) \
+ __extension__ \
+ ({ \
+ __typeof__(p) _________p1 = CMM_LOAD_SHARED(p); \
cmm_smp_read_barrier_depends(); \
(_________p1); \
})
cmm_smp_read_barrier_depends(); \
(_________p1); \
})
@@
-73,12
+78,16
@@
extern "C" {
* data structure, which can be safely freed after waiting for a quiescent state
* using synchronize_rcu(). If fails (unexpected value), returns old (which
* should not be freed !).
* data structure, which can be safely freed after waiting for a quiescent state
* using synchronize_rcu(). If fails (unexpected value), returns old (which
* should not be freed !).
+ *
+ * This macro is less than 10 lines long. The intent is that this macro
+ * meets the 10-line criterion in LGPL, allowing this function to be
+ * expanded directly in non-LGPL code.
*/
*/
-
#define _rcu_cmpxchg_pointer(p, old, _new) \
#define _rcu_cmpxchg_pointer(p, old, _new) \
+ __extension__ \
({ \
({ \
-
typeof(*p) _________pold = (old);
\
-
typeof(*p) _________pnew = (_new);
\
+
__typeof__(*p) _________pold = (old);
\
+
__typeof__(*p) _________pnew = (_new);
\
if (!__builtin_constant_p(_new) || \
((_new) != NULL)) \
cmm_wmb(); \
if (!__builtin_constant_p(_new) || \
((_new) != NULL)) \
cmm_wmb(); \
@@
-89,11
+98,15
@@
extern "C" {
* _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous
* pointer to the data structure, which can be safely freed after waiting for a
* quiescent state using synchronize_rcu().
* _rcu_xchg_pointer - same as rcu_assign_pointer, but returns the previous
* pointer to the data structure, which can be safely freed after waiting for a
* quiescent state using synchronize_rcu().
+ *
+ * This macro is less than 10 lines long. The intent is that this macro
+ * meets the 10-line criterion in LGPL, allowing this function to be
+ * expanded directly in non-LGPL code.
*/
*/
-
#define _rcu_xchg_pointer(p, v) \
#define _rcu_xchg_pointer(p, v) \
+ __extension__ \
({ \
({ \
-
typeof(*p) _________pv = (v);
\
+
__typeof__(*p) _________pv = (v);
\
if (!__builtin_constant_p(v) || \
((v) != NULL)) \
cmm_wmb(); \
if (!__builtin_constant_p(v) || \
((v) != NULL)) \
cmm_wmb(); \
@@
-102,13
+115,13
@@
extern "C" {
#define _rcu_set_pointer(p, v) \
#define _rcu_set_pointer(p, v) \
-
({
\
-
typeof(*p) _________pv = (v);
\
+
do {
\
+
__typeof__(*p) _________pv = (v);
\
if (!__builtin_constant_p(v) || \
((v) != NULL)) \
cmm_wmb(); \
uatomic_set(p, _________pv); \
if (!__builtin_constant_p(v) || \
((v) != NULL)) \
cmm_wmb(); \
uatomic_set(p, _________pv); \
- })
+ }
while (0
)
/**
* _rcu_assign_pointer - assign (publicize) a pointer to a new data structure
/**
* _rcu_assign_pointer - assign (publicize) a pointer to a new data structure
@@
-120,9
+133,12
@@
extern "C" {
* them. It also makes sure the compiler does not reorder code initializing the
* data structure before its publication.
*
* them. It also makes sure the compiler does not reorder code initializing the
* data structure before its publication.
*
- * Should match rcu_dereference_pointer().
+ * Should match rcu_dereference().
+ *
+ * This macro is less than 10 lines long. The intent is that this macro
+ * meets the 10-line criterion in LGPL, allowing this function to be
+ * expanded directly in non-LGPL code.
*/
*/
-
#define _rcu_assign_pointer(p, v) _rcu_set_pointer(&(p), v)
#ifdef __cplusplus
#define _rcu_assign_pointer(p, v) _rcu_set_pointer(&(p), v)
#ifdef __cplusplus
This page took
0.025832 seconds
and
4
git commands to generate.