Skip to contentSkip to conversation

wfcqueue: add C++ compatibility API

RFC PATCH New Mathieu Desnoyers 2 participants 5 messages Mar 8, 2016 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

RFC PATCH 2/2 wfcqueue: add C++ compatibility API

Introduce __cds_wfcq_head_cast and cds_wfcq_head_cast for compability of wfcqueue with c++. Those are effect-less in C, where transparent unions are supported. However, in C++, those transform struct cds_wfcq_head and struct __cds_wfcq_head pointers to cds_wfcq_head_ptr_t.

---
 urcu/static/wfcqueue.h | 16 +++++++++-------
 urcu/wfcqueue.h        | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 7 deletions(-)
urcu/static/wfcqueue.h +9 -7
index 7c9d548..4ababbf 100644
@@ -257,7 +257,7 @@ ___cds_wfcq_first(cds_wfcq_head_ptr_t u_head,
 	struct __cds_wfcq_head *head = u_head._h;
 	struct cds_wfcq_node *node;
 
-	if (_cds_wfcq_empty(head, tail))
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(head), tail))
 		return NULL;
 	node = ___cds_wfcq_node_sync_next(&head->node, blocking);
 	/* Load head->node.next before loading node's content */
@@ -375,7 +375,7 @@ ___cds_wfcq_dequeue_with_state(cds_wfcq_head_ptr_t u_head,
 	if (state)
 		*state = 0;
 
-	if (_cds_wfcq_empty(head, tail)) {
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(head), tail)) {
 		return NULL;
 	}
 
@@ -509,7 +509,7 @@ ___cds_wfcq_splice(
 	 * Initial emptiness check to speed up cases where queue is
 	 * empty: only require loads to check if queue is empty.
 	 */
-	if (_cds_wfcq_empty(src_q_head, src_q_tail))
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(src_q_head), src_q_tail))
 		return CDS_WFCQ_RET_SRC_EMPTY;
 
 	for (;;) {
@@ -539,7 +539,8 @@ ___cds_wfcq_splice(
 	 * Append the spliced content of src_q into dest_q. Does not
 	 * require mutual exclusion on dest_q (wait-free).
 	 */
-	if (___cds_wfcq_append(dest_q_head, dest_q_tail, head, tail))
+	if (___cds_wfcq_append(__cds_wfcq_head_cast(dest_q_head), dest_q_tail,
+			head, tail))
 		return CDS_WFCQ_RET_DEST_NON_EMPTY;
 	else
 		return CDS_WFCQ_RET_DEST_EMPTY;
@@ -599,7 +600,8 @@ _cds_wfcq_dequeue_with_state_blocking(struct cds_wfcq_head *head,
 	struct cds_wfcq_node *retval;
 
 	_cds_wfcq_dequeue_lock(head, tail);
-	retval = ___cds_wfcq_dequeue_with_state_blocking(head, tail, state);
+	retval = ___cds_wfcq_dequeue_with_state_blocking(cds_wfcq_head_cast(head),
+			tail, state);
 	_cds_wfcq_dequeue_unlock(head, tail);
 	return retval;
 }
@@ -638,8 +640,8 @@ _cds_wfcq_splice_blocking(
 	enum cds_wfcq_ret ret;
 
 	_cds_wfcq_dequeue_lock(src_q_head, src_q_tail);
-	ret = ___cds_wfcq_splice_blocking(dest_q_head, dest_q_tail,
-			src_q_head, src_q_tail);
+	ret = ___cds_wfcq_splice_blocking(cds_wfcq_head_cast(dest_q_head), dest_q_tail,
+			cds_wfcq_head_cast(src_q_head), src_q_tail);
 	_cds_wfcq_dequeue_unlock(src_q_head, src_q_tail);
 	return ret;
 }
urcu/wfcqueue.h +40 -0
index c0bb289..ec86032 100644
@@ -74,6 +74,7 @@ struct cds_wfcq_head {
 	pthread_mutex_t lock;
 };
 
+#ifndef __cplusplus
 /*
  * The transparent union allows calling functions that work on both
  * struct cds_wfcq_head and struct __cds_wfcq_head on any of those two
@@ -84,6 +85,45 @@ typedef union {
 	struct cds_wfcq_head *h;
 } __attribute__((__transparent_union__)) cds_wfcq_head_ptr_t;
 
+/*
+ * This static inline is only present for compatibility with C++. It is
+ * effect-less in C.
+ */
+static inline struct __cds_wfcq_head *__cds_wfcq_head_cast(struct __cds_wfcq_head *head)
+{
+	return head;
+}
+
+/*
+ * This static inline is only present for compatibility with C++. It is
+ * effect-less in C.
+ */
+static inline struct cds_wfcq_head *cds_wfcq_head_cast(struct cds_wfcq_head *head)
+{
+	return head;
+}
+#else /* #ifndef __cplusplus */
+
+/* C++ ignores transparent union. */
+typedef union {
+	struct __cds_wfcq_head *_h;
+	struct cds_wfcq_head *h;
+} cds_wfcq_head_ptr_t;
+
+/* C++ ignores transparent union. Requires an explicit conversion. */
+static inline cds_wfcq_head_ptr_t __cds_wfcq_head_cast(struct __cds_wfcq_head *head)
+{
+	cds_wfcq_head_ptr_t ret = { ._h = head };
+	return ret;
+}
+/* C++ ignores transparent union. Requires an explicit conversion. */
+static inline cds_wfcq_head_ptr_t cds_wfcq_head_cast(struct cds_wfcq_head *head)
+{
+	cds_wfcq_head_ptr_t ret = { .h = head };
+	return ret;
+}
+#endif /* #else #ifndef __cplusplus */
+
 struct cds_wfcq_tail {
 	struct cds_wfcq_node *p;
 };
Signature · 1 line
2.1.4
Reviewed-by Tested-by
#2 lore raw

Re: [RFC PATCH urcu 1/2] Fix: CDS_WFCQ_WOULDBLOCK typing for c++

In reply to a message not in the archive
Quoted 1 line · Mathieu Desnoyers
Quoted 20 lines
---
 urcu/wfcqueue.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
urcu/wfcqueue.h +1 -1
index 83ec219..c0bb289 100644
@@ -43,7 +43,7 @@ extern "C" {
  * McKenney.
  */
 
-#define CDS_WFCQ_WOULDBLOCK	((void *) -1UL)
+#define CDS_WFCQ_WOULDBLOCK	((struct cds_wfcq_node *) -1UL)
 
 enum cds_wfcq_ret {
 	CDS_WFCQ_RET_WOULDBLOCK =	-1,
Signature · 1 line
2.1.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by Tested-by
#4 lore raw
Quoted 7 lines · Mathieu Desnoyers

Introduce __cds_wfcq_head_cast and cds_wfcq_head_cast for compability of wfcqueue with c++. Those are effect-less in C, where transparent unions are supported. However, in C++, those transform struct cds_wfcq_head and struct __cds_wfcq_head pointers to cds_wfcq_head_ptr_t.

Good stuff!!!

Quoted 128 lines
---
 urcu/static/wfcqueue.h | 16 +++++++++-------
 urcu/wfcqueue.h        | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 7 deletions(-)
urcu/static/wfcqueue.h +9 -7
index 7c9d548..4ababbf 100644
@@ -257,7 +257,7 @@ ___cds_wfcq_first(cds_wfcq_head_ptr_t u_head,
 	struct __cds_wfcq_head *head = u_head._h;
 	struct cds_wfcq_node *node;
 
-	if (_cds_wfcq_empty(head, tail))
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(head), tail))
 		return NULL;
 	node = ___cds_wfcq_node_sync_next(&head->node, blocking);
 	/* Load head->node.next before loading node's content */
@@ -375,7 +375,7 @@ ___cds_wfcq_dequeue_with_state(cds_wfcq_head_ptr_t u_head,
 	if (state)
 		*state = 0;
 
-	if (_cds_wfcq_empty(head, tail)) {
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(head), tail)) {
 		return NULL;
 	}
 
@@ -509,7 +509,7 @@ ___cds_wfcq_splice(
 	 * Initial emptiness check to speed up cases where queue is
 	 * empty: only require loads to check if queue is empty.
 	 */
-	if (_cds_wfcq_empty(src_q_head, src_q_tail))
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(src_q_head), src_q_tail))
 		return CDS_WFCQ_RET_SRC_EMPTY;
 
 	for (;;) {
@@ -539,7 +539,8 @@ ___cds_wfcq_splice(
 	 * Append the spliced content of src_q into dest_q. Does not
 	 * require mutual exclusion on dest_q (wait-free).
 	 */
-	if (___cds_wfcq_append(dest_q_head, dest_q_tail, head, tail))
+	if (___cds_wfcq_append(__cds_wfcq_head_cast(dest_q_head), dest_q_tail,
+			head, tail))
 		return CDS_WFCQ_RET_DEST_NON_EMPTY;
 	else
 		return CDS_WFCQ_RET_DEST_EMPTY;
@@ -599,7 +600,8 @@ _cds_wfcq_dequeue_with_state_blocking(struct cds_wfcq_head *head,
 	struct cds_wfcq_node *retval;
 
 	_cds_wfcq_dequeue_lock(head, tail);
-	retval = ___cds_wfcq_dequeue_with_state_blocking(head, tail, state);
+	retval = ___cds_wfcq_dequeue_with_state_blocking(cds_wfcq_head_cast(head),
+			tail, state);
 	_cds_wfcq_dequeue_unlock(head, tail);
 	return retval;
 }
@@ -638,8 +640,8 @@ _cds_wfcq_splice_blocking(
 	enum cds_wfcq_ret ret;
 
 	_cds_wfcq_dequeue_lock(src_q_head, src_q_tail);
-	ret = ___cds_wfcq_splice_blocking(dest_q_head, dest_q_tail,
-			src_q_head, src_q_tail);
+	ret = ___cds_wfcq_splice_blocking(cds_wfcq_head_cast(dest_q_head), dest_q_tail,
+			cds_wfcq_head_cast(src_q_head), src_q_tail);
 	_cds_wfcq_dequeue_unlock(src_q_head, src_q_tail);
 	return ret;
 }
urcu/wfcqueue.h +40 -0
index c0bb289..ec86032 100644
@@ -74,6 +74,7 @@ struct cds_wfcq_head {
 	pthread_mutex_t lock;
 };
 
+#ifndef __cplusplus
 /*
  * The transparent union allows calling functions that work on both
  * struct cds_wfcq_head and struct __cds_wfcq_head on any of those two
@@ -84,6 +85,45 @@ typedef union {
 	struct cds_wfcq_head *h;
 } __attribute__((__transparent_union__)) cds_wfcq_head_ptr_t;
 
+/*
+ * This static inline is only present for compatibility with C++. It is
+ * effect-less in C.
+ */
+static inline struct __cds_wfcq_head *__cds_wfcq_head_cast(struct __cds_wfcq_head *head)
+{
+	return head;
+}
+
+/*
+ * This static inline is only present for compatibility with C++. It is
+ * effect-less in C.
+ */
+static inline struct cds_wfcq_head *cds_wfcq_head_cast(struct cds_wfcq_head *head)
+{
+	return head;
+}
+#else /* #ifndef __cplusplus */
+
+/* C++ ignores transparent union. */
+typedef union {
+	struct __cds_wfcq_head *_h;
+	struct cds_wfcq_head *h;
+} cds_wfcq_head_ptr_t;
+
+/* C++ ignores transparent union. Requires an explicit conversion. */
+static inline cds_wfcq_head_ptr_t __cds_wfcq_head_cast(struct __cds_wfcq_head *head)
+{
+	cds_wfcq_head_ptr_t ret = { ._h = head };
+	return ret;
+}
+/* C++ ignores transparent union. Requires an explicit conversion. */
+static inline cds_wfcq_head_ptr_t cds_wfcq_head_cast(struct cds_wfcq_head *head)
+{
+	cds_wfcq_head_ptr_t ret = { .h = head };
+	return ret;
+}
+#endif /* #else #ifndef __cplusplus */
+
 struct cds_wfcq_tail {
 	struct cds_wfcq_node *p;
 };
Signature · 1 line
2.1.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 7 lines · ----- On Mar 8, 2016, at 12:11 PM, Paul E. McKenney [email protected]…
Quoted 6 lines · Mathieu Desnoyers

Introduce __cds_wfcq_head_cast and cds_wfcq_head_cast for compability of wfcqueue with c++. Those are effect-less in C, where transparent unions are supported. However, in C++, those transform struct cds_wfcq_head and struct __cds_wfcq_head pointers to cds_wfcq_head_ptr_t.

Quoted 6 lines
Quoted 1 line

Good stuff!!!

Thanks!

Will merge into urcu master and stable-0.9.

Mathieu

Quoted 134 lines
Quoted 134 lines
---
 urcu/static/wfcqueue.h | 16 +++++++++-------
 urcu/wfcqueue.h        | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 7 deletions(-)
urcu/static/wfcqueue.h +7 -5
index 7c9d548..4ababbf 100644
@@ -257,7 +257,7 @@ ___cds_wfcq_first(cds_wfcq_head_ptr_t u_head,
 	struct __cds_wfcq_head *head = u_head._h;
 	struct cds_wfcq_node *node;
 
-	if (_cds_wfcq_empty(head, tail))
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(head), tail))
 		return NULL;
 	node = ___cds_wfcq_node_sync_next(&head->node, blocking);
 	/* Load head->node.next before loading node's content */
@@ -375,7 +375,7 @@ ___cds_wfcq_dequeue_with_state(cds_wfcq_head_ptr_t u_head,
 	if (state)
 		*state = 0;
 
-	if (_cds_wfcq_empty(head, tail)) {
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(head), tail)) {
 		return NULL;
 	}
 
@@ -509,7 +509,7 @@ ___cds_wfcq_splice(
 	 * Initial emptiness check to speed up cases where queue is
 	 * empty: only require loads to check if queue is empty.
 	 */
-	if (_cds_wfcq_empty(src_q_head, src_q_tail))
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(src_q_head), src_q_tail))
 		return CDS_WFCQ_RET_SRC_EMPTY;
 
 	for (;;) {
@@ -539,7 +539,8 @@ ___cds_wfcq_splice(
 	 * Append the spliced content of src_q into dest_q. Does not
 	 * require mutual exclusion on dest_q (wait-free).
 	 */
-	if (___cds_wfcq_append(dest_q_head, dest_q_tail, head, tail))
+	if (___cds_wfcq_append(__cds_wfcq_head_cast(dest_q_head), dest_q_tail,
+			head, tail))
 		return CDS_WFCQ_RET_DEST_NON_EMPTY;
 	else
 		return CDS_WFCQ_RET_DEST_EMPTY;
@@ -599,7 +600,8 @@ _cds_wfcq_dequeue_with_state_blocking(struct cds_wfcq_head
 *head,
 	struct cds_wfcq_node *retval;
 
 	_cds_wfcq_dequeue_lock(head, tail);
-	retval = ___cds_wfcq_dequeue_with_state_blocking(head, tail, state);
+	retval = ___cds_wfcq_dequeue_with_state_blocking(cds_wfcq_head_cast(head),
+			tail, state);
 	_cds_wfcq_dequeue_unlock(head, tail);
 	return retval;

}

urcu/static/wfcqueue.h +2 -2
@@ -638,8 +640,8 @@ _cds_wfcq_splice_blocking(
 	enum cds_wfcq_ret ret;
 
 	_cds_wfcq_dequeue_lock(src_q_head, src_q_tail);
-	ret = ___cds_wfcq_splice_blocking(dest_q_head, dest_q_tail,
-			src_q_head, src_q_tail);
+	ret = ___cds_wfcq_splice_blocking(cds_wfcq_head_cast(dest_q_head),
 dest_q_tail,
+			cds_wfcq_head_cast(src_q_head), src_q_tail);
 	_cds_wfcq_dequeue_unlock(src_q_head, src_q_tail);
 	return ret;

}

urcu/wfcqueue.h +34 -0
index c0bb289..ec86032 100644
@@ -74,6 +74,7 @@ struct cds_wfcq_head {
 	pthread_mutex_t lock;
 };
 
+#ifndef __cplusplus
 /*
  * The transparent union allows calling functions that work on both
  * struct cds_wfcq_head and struct __cds_wfcq_head on any of those two
@@ -84,6 +85,45 @@ typedef union {
 	struct cds_wfcq_head *h;
 } __attribute__((__transparent_union__)) cds_wfcq_head_ptr_t;
 
+/*
+ * This static inline is only present for compatibility with C++. It is
+ * effect-less in C.
+ */
+static inline struct __cds_wfcq_head *__cds_wfcq_head_cast(struct
 __cds_wfcq_head *head)
+{
+	return head;
+}
+
+/*
+ * This static inline is only present for compatibility with C++. It is
+ * effect-less in C.
+ */
+static inline struct cds_wfcq_head *cds_wfcq_head_cast(struct cds_wfcq_head
 *head)
+{
+	return head;
+}
+#else /* #ifndef __cplusplus */
+
+/* C++ ignores transparent union. */
+typedef union {
+	struct __cds_wfcq_head *_h;
+	struct cds_wfcq_head *h;
+} cds_wfcq_head_ptr_t;
+
+/* C++ ignores transparent union. Requires an explicit conversion. */
+static inline cds_wfcq_head_ptr_t __cds_wfcq_head_cast(struct __cds_wfcq_head
 *head)
+{
+	cds_wfcq_head_ptr_t ret = { ._h = head };
+	return ret;
+}
+/* C++ ignores transparent union. Requires an explicit conversion. */
+static inline cds_wfcq_head_ptr_t cds_wfcq_head_cast(struct cds_wfcq_head

*head)

urcu/wfcqueue.h +6 -1
+{
+	cds_wfcq_head_ptr_t ret = { .h = head };
+	return ret;
+}
+#endif /* #else #ifndef __cplusplus */
+
 struct cds_wfcq_tail {
 	struct cds_wfcq_node *p;
 };
--

2.1.4

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 11 lines · Mathieu Desnoyers
Quoted 9 lines · ----- On Mar 8, 2016, at 12:11 PM, Paul E. McKenney [email protected]…
Quoted 7 lines · Mathieu Desnoyers

Introduce __cds_wfcq_head_cast and cds_wfcq_head_cast for compability of wfcqueue with c++. Those are effect-less in C, where transparent unions are supported. However, in C++, those transform struct cds_wfcq_head and struct __cds_wfcq_head pointers to cds_wfcq_head_ptr_t.

Quoted 8 lines
Quoted 4 lines

Good stuff!!!

Thanks!

Will merge into urcu master and stable-0.9.

Very good, thank you!!!

Thanx, Paul

Quoted 142 lines

Mathieu

Quoted 134 lines
Quoted 134 lines
---
 urcu/static/wfcqueue.h | 16 +++++++++-------
 urcu/wfcqueue.h        | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 7 deletions(-)
urcu/static/wfcqueue.h +7 -5
index 7c9d548..4ababbf 100644
@@ -257,7 +257,7 @@ ___cds_wfcq_first(cds_wfcq_head_ptr_t u_head,
 	struct __cds_wfcq_head *head = u_head._h;
 	struct cds_wfcq_node *node;
 
-	if (_cds_wfcq_empty(head, tail))
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(head), tail))
 		return NULL;
 	node = ___cds_wfcq_node_sync_next(&head->node, blocking);
 	/* Load head->node.next before loading node's content */
@@ -375,7 +375,7 @@ ___cds_wfcq_dequeue_with_state(cds_wfcq_head_ptr_t u_head,
 	if (state)
 		*state = 0;
 
-	if (_cds_wfcq_empty(head, tail)) {
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(head), tail)) {
 		return NULL;
 	}
 
@@ -509,7 +509,7 @@ ___cds_wfcq_splice(
 	 * Initial emptiness check to speed up cases where queue is
 	 * empty: only require loads to check if queue is empty.
 	 */
-	if (_cds_wfcq_empty(src_q_head, src_q_tail))
+	if (_cds_wfcq_empty(__cds_wfcq_head_cast(src_q_head), src_q_tail))
 		return CDS_WFCQ_RET_SRC_EMPTY;
 
 	for (;;) {
@@ -539,7 +539,8 @@ ___cds_wfcq_splice(
 	 * Append the spliced content of src_q into dest_q. Does not
 	 * require mutual exclusion on dest_q (wait-free).
 	 */
-	if (___cds_wfcq_append(dest_q_head, dest_q_tail, head, tail))
+	if (___cds_wfcq_append(__cds_wfcq_head_cast(dest_q_head), dest_q_tail,
+			head, tail))
 		return CDS_WFCQ_RET_DEST_NON_EMPTY;
 	else
 		return CDS_WFCQ_RET_DEST_EMPTY;
@@ -599,7 +600,8 @@ _cds_wfcq_dequeue_with_state_blocking(struct cds_wfcq_head
 *head,
 	struct cds_wfcq_node *retval;
 
 	_cds_wfcq_dequeue_lock(head, tail);
-	retval = ___cds_wfcq_dequeue_with_state_blocking(head, tail, state);
+	retval = ___cds_wfcq_dequeue_with_state_blocking(cds_wfcq_head_cast(head),
+			tail, state);
 	_cds_wfcq_dequeue_unlock(head, tail);
 	return retval;

}

urcu/static/wfcqueue.h +2 -2
@@ -638,8 +640,8 @@ _cds_wfcq_splice_blocking(
 	enum cds_wfcq_ret ret;
 
 	_cds_wfcq_dequeue_lock(src_q_head, src_q_tail);
-	ret = ___cds_wfcq_splice_blocking(dest_q_head, dest_q_tail,
-			src_q_head, src_q_tail);
+	ret = ___cds_wfcq_splice_blocking(cds_wfcq_head_cast(dest_q_head),
 dest_q_tail,
+			cds_wfcq_head_cast(src_q_head), src_q_tail);
 	_cds_wfcq_dequeue_unlock(src_q_head, src_q_tail);
 	return ret;

}

urcu/wfcqueue.h +34 -0
index c0bb289..ec86032 100644
@@ -74,6 +74,7 @@ struct cds_wfcq_head {
 	pthread_mutex_t lock;
 };
 
+#ifndef __cplusplus
 /*
  * The transparent union allows calling functions that work on both
  * struct cds_wfcq_head and struct __cds_wfcq_head on any of those two
@@ -84,6 +85,45 @@ typedef union {
 	struct cds_wfcq_head *h;
 } __attribute__((__transparent_union__)) cds_wfcq_head_ptr_t;
 
+/*
+ * This static inline is only present for compatibility with C++. It is
+ * effect-less in C.
+ */
+static inline struct __cds_wfcq_head *__cds_wfcq_head_cast(struct
 __cds_wfcq_head *head)
+{
+	return head;
+}
+
+/*
+ * This static inline is only present for compatibility with C++. It is
+ * effect-less in C.
+ */
+static inline struct cds_wfcq_head *cds_wfcq_head_cast(struct cds_wfcq_head
 *head)
+{
+	return head;
+}
+#else /* #ifndef __cplusplus */
+
+/* C++ ignores transparent union. */
+typedef union {
+	struct __cds_wfcq_head *_h;
+	struct cds_wfcq_head *h;
+} cds_wfcq_head_ptr_t;
+
+/* C++ ignores transparent union. Requires an explicit conversion. */
+static inline cds_wfcq_head_ptr_t __cds_wfcq_head_cast(struct __cds_wfcq_head
 *head)
+{
+	cds_wfcq_head_ptr_t ret = { ._h = head };
+	return ret;
+}
+/* C++ ignores transparent union. Requires an explicit conversion. */
+static inline cds_wfcq_head_ptr_t cds_wfcq_head_cast(struct cds_wfcq_head

*head)

urcu/wfcqueue.h +6 -1
+{
+	cds_wfcq_head_ptr_t ret = { .h = head };
+	return ret;
+}
+#endif /* #else #ifndef __cplusplus */
+
 struct cds_wfcq_tail {
 	struct cds_wfcq_node *p;
 };
--

2.1.4

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com