[lttng-dev] Horrible hack to make C++ link to liburcu

Paul E. McKenney paulmck at linux.vnet.ibm.com
Fri Mar 4 20:32:54 UTC 2016


Hello!

Still working with the C++ standards committee to add RCU to C++, and
of course one step on that path is to make C++ programs build against
liburcu.  The following hack-patch makes this work by disabling C++ access
to wfcqueue and by making C++ see the rcu_head ->next field as a void *.

This supports prototyping, but what would be the real fix?

							Thanx, Paul

------------------------------------------------------------------------

diff --git a/urcu-call-rcu.h b/urcu-call-rcu.h
index 339ebacc3f7c..d37c49e9d958 100644
--- a/urcu-call-rcu.h
+++ b/urcu-call-rcu.h
@@ -32,7 +32,9 @@
 #include <stdlib.h>
 #include <pthread.h>
 
+#ifndef __cplusplus
 #include <urcu/wfcqueue.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -57,7 +59,11 @@ struct call_rcu_data;
  */
 
 struct rcu_head {
+#ifdef __cplusplus
+	void *next;
+#else
 	struct cds_wfcq_node next;
+#endif
 	void (*func)(struct rcu_head *head);
 };
 




More information about the lttng-dev mailing list