1 /* Copyright (C) 2002 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
5 Copyright (C) 2009 Pierre-Marc Fournier
6 Conversion to RCU list.
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with the GNU C Library; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 #ifndef _URCU_RCULIST_H
24 #define _URCU_RCULIST_H
26 #include <urcu/list.h>
27 #include <urcu/arch.h>
28 #include <urcu-pointer.h>
30 /* Add new element at the head of the list.
32 static inline void list_add_rcu(list_t
*newp
, list_t
*head
)
34 newp
->next
= head
->next
;
37 head
->next
->prev
= newp
;
42 /* Remove element from list. */
43 static inline void list_del_rcu(list_t
*elem
)
45 elem
->next
->prev
= elem
->prev
;
46 elem
->prev
->next
= elem
->next
;
50 /* Iterate through elements of the list.
51 * This must be done while rcu_read_lock() is held.
54 #define list_for_each_entry_rcu(pos, head, member) \
55 for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), member); \
56 &pos->member != (head); \
57 pos = list_entry(rcu_dereference(pos->member.next), typeof(*pos), member))
59 #endif /* _URCU_RCULIST_H */
This page took 0.033614 seconds and 4 git commands to generate.