]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/frrcu.h
tests: Topotest fixes to skip comparing InterfaceIndex and Internal status in json_cmp
[mirror_frr.git] / lib / frrcu.h
index 8f789303cc5cdfc43a27378d2f026dd7d1140dc9..47751ae7df395a01fd82b0c1ff6d53cd1597737a 100644 (file)
 
 #include "memory.h"
 #include "atomlist.h"
-#include "seqlock.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* quick RCU primer:
  *   There's a global sequence counter.  Whenever a thread does a
@@ -139,6 +142,8 @@ extern void rcu_enqueue(struct rcu_head *head, const struct rcu_action *action);
 #define rcu_free(mtype, ptr, field)                                            \
        do {                                                                   \
                typeof(ptr) _ptr = (ptr);                                      \
+               if (!_ptr)                                                     \
+                       break;                                                 \
                struct rcu_head *_rcu_head = &_ptr->field;                     \
                static const struct rcu_action _rcu_action = {                 \
                        .type = RCUA_FREE,                                     \
@@ -169,4 +174,8 @@ extern void rcu_enqueue(struct rcu_head *head, const struct rcu_action *action);
 
 extern void rcu_close(struct rcu_head_close *head, int fd);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _FRRCU_H */