1 #ifndef _URCU_RCULFQUEUE_H
2 #define _URCU_RCULFQUEUE_H
7 * Userspace RCU library - Lock-Free RCU Queue
9 * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
32 struct cds_lfq_queue_rcu
;
35 struct cds_lfq_node_rcu
{
36 struct cds_lfq_node_rcu
*next
;
40 struct cds_lfq_queue_rcu
{
41 struct cds_lfq_node_rcu
*head
, *tail
;
42 void (*queue_call_rcu
)(struct rcu_head
*head
,
43 void (*func
)(struct rcu_head
*head
));
48 #include <urcu/static/rculfqueue.h>
50 #define cds_lfq_node_init_rcu _cds_lfq_node_init_rcu
51 #define cds_lfq_init_rcu _cds_lfq_init_rcu
52 #define cds_lfq_destroy_rcu _cds_lfq_destroy_rcu
53 #define cds_lfq_enqueue_rcu _cds_lfq_enqueue_rcu
54 #define cds_lfq_dequeue_rcu _cds_lfq_dequeue_rcu
56 #else /* !_LGPL_SOURCE */
58 extern void cds_lfq_node_init_rcu(struct cds_lfq_node_rcu
*node
);
59 extern void cds_lfq_init_rcu(struct cds_lfq_queue_rcu
*q
,
60 void queue_call_rcu(struct rcu_head
*head
,
61 void (*func
)(struct rcu_head
*head
)));
63 * The queue should be emptied before calling destroy.
65 * Return 0 on success, -EPERM if queue is not empty.
67 extern int cds_lfq_destroy_rcu(struct cds_lfq_queue_rcu
*q
);
70 * Should be called under rcu read lock critical section.
72 extern void cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu
*q
,
73 struct cds_lfq_node_rcu
*node
);
76 * Should be called under rcu read lock critical section.
78 * The caller must wait for a grace period to pass before freeing the returned
79 * node or modifying the cds_lfq_node_rcu structure.
80 * Returns NULL if queue is empty.
83 struct cds_lfq_node_rcu
*cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu
*q
);
85 #endif /* !_LGPL_SOURCE */
91 #endif /* _URCU_RCULFQUEUE_H */
This page took 0.030558 seconds and 4 git commands to generate.