0e3c9109a9288c42bd0f85290b9d18f3b34db377
1 // SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 // SPDX-License-Identifier: LGPL-2.1-or-later
5 #ifndef _URCU_RCULFQUEUE_H
6 #define _URCU_RCULFQUEUE_H
9 * Userspace RCU library - Lock-Free RCU Queue
17 struct cds_lfq_queue_rcu
;
20 struct cds_lfq_node_rcu
{
21 struct cds_lfq_node_rcu
*next
;
25 struct cds_lfq_queue_rcu
{
26 struct cds_lfq_node_rcu
*head
, *tail
;
27 void (*queue_call_rcu
)(struct rcu_head
*head
,
28 void (*func
)(struct rcu_head
*head
));
33 #include <urcu/static/rculfqueue.h>
35 #define cds_lfq_node_init_rcu _cds_lfq_node_init_rcu
36 #define cds_lfq_init_rcu _cds_lfq_init_rcu
37 #define cds_lfq_destroy_rcu _cds_lfq_destroy_rcu
38 #define cds_lfq_enqueue_rcu _cds_lfq_enqueue_rcu
39 #define cds_lfq_dequeue_rcu _cds_lfq_dequeue_rcu
41 #else /* !_LGPL_SOURCE */
43 extern void cds_lfq_node_init_rcu(struct cds_lfq_node_rcu
*node
);
44 extern void cds_lfq_init_rcu(struct cds_lfq_queue_rcu
*q
,
45 void queue_call_rcu(struct rcu_head
*head
,
46 void (*func
)(struct rcu_head
*head
)));
48 * The queue should be emptied before calling destroy.
50 * Return 0 on success, -EPERM if queue is not empty.
52 extern int cds_lfq_destroy_rcu(struct cds_lfq_queue_rcu
*q
);
55 * Should be called under rcu read lock critical section.
57 extern void cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu
*q
,
58 struct cds_lfq_node_rcu
*node
);
61 * Should be called under rcu read lock critical section.
63 * The caller must wait for a grace period to pass before freeing the returned
64 * node or modifying the cds_lfq_node_rcu structure.
65 * Returns NULL if queue is empty.
68 struct cds_lfq_node_rcu
*cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu
*q
);
70 #endif /* !_LGPL_SOURCE */
76 #endif /* _URCU_RCULFQUEUE_H */
This page took 0.031635 seconds and 5 git commands to generate.