Restrict supported arch ot P6+ on Intel x86 32.
[urcu.git] / urcu / rculist.h
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.
4
5 Copyright (C) 2009 Pierre-Marc Fournier
6 Conversion to RCU list.
7
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.
12
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.
17
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
21 02111-1307 USA. */
22
23 #ifndef _URCU_RCULIST_H
24 #define _URCU_RCULIST_H
25
26 #include <urcu/list.h>
27 #include <urcu/arch.h>
28 #include <urcu-pointer.h>
29
30 /* Add new element at the head of the list.
31 */
32 static inline void list_add_rcu(list_t *newp, list_t *head)
33 {
34 newp->next = head->next;
35 newp->prev = head;
36 smp_wmb();
37 head->next->prev = newp;
38 head->next = newp;
39 }
40
41
42 /* Remove element from list. */
43 static inline void list_del_rcu(list_t *elem)
44 {
45 elem->next->prev = elem->prev;
46 elem->prev->next = elem->next;
47 }
48
49
50 /* Iterate through elements of the list.
51 * This must be done while rcu_read_lock() is held.
52 */
53
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))
58
59 #endif /* _URCU_RCULIST_H */
This page took 0.029351 seconds and 4 git commands to generate.