RCU list: add rcuhlist.h, add list_replace_rcu
[urcu.git] / urcu / list.h
index 7ccb76aeee760f0686155c0de34e568fc49fc50b..d26751204192993c68c48010f7e931e18c6bfa2b 100644 (file)
@@ -65,14 +65,39 @@ list_add_tail (list_t *newp, list_t *head)
 }
 
 
+/* Remove element from list.  */
+static inline void
+__list_del (list_t *prev, list_t *next)
+{
+  next->prev = prev;
+  prev->next = next;
+}
+
 /* Remove element from list.  */
 static inline void
 list_del (list_t *elem)
 {
-  elem->next->prev = elem->prev;
-  elem->prev->next = elem->next;
+  __list_del (elem->prev, elem->next);
+}
+
+/* delete from list, add to another list as head */
+static inline void
+list_move (list_t *elem, list_t *head)
+{
+  __list_del (elem->prev, elem->next);
+  list_add (elem, head);
 }
 
+/* replace an old entry.
+ */
+static inline void
+list_replace(list_t *old, list_t *_new)
+{
+       _new->next = old->next;
+       _new->prev = old->prev;
+       _new->prev->next = _new;
+       _new->next->prev = _new;
+}
 
 /* Join two lists.  */
 static inline void
This page took 0.022385 seconds and 4 git commands to generate.