+static inline
+struct cds_wfs_node *
+___cds_wfs_pop(struct cds_wfs_stack *s, int blocking)
+{
+ struct cds_wfs_head *head, *new_head;
+ struct cds_wfs_node *next;
+
+ for (;;) {
+ head = CMM_LOAD_SHARED(s->head);
+ if (___cds_wfs_end(head))
+ return NULL;
+ next = ___cds_wfs_node_sync_next(&head->node, blocking);
+ if (!blocking && next == CDS_WFS_WOULDBLOCK)
+ return CDS_WFS_WOULDBLOCK;
+ new_head = caa_container_of(next, struct cds_wfs_head, node);
+ if (uatomic_cmpxchg(&s->head, head, new_head) == head)
+ return &head->node;
+ if (!blocking)
+ return CDS_WFS_WOULDBLOCK;
+ /* busy-loop if head changed under us */
+ }
+}
+