2 * \brief A non-blocking linked list implementation, derived from Tim Harris' `pragmatic implementation`.
6 * Copyright (c) 2009, ETH Zurich.
9 * This file is distributed under the terms in the attached LICENSE file.
10 * If you do not find this file, copies can be found by writing to:
11 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
13 #ifndef LINKED_LIST_H_
14 #define LINKED_LIST_H_
16 #include <sys/cdefs.h>
21 struct ll_element *next;
27 * \brief create a new (empty) linked list. Creation is not thread-safe.
29 void ll_create(struct ll_element **head, struct ll_element **tail);
32 * \brief insert a new element into the linked list.
34 bool ll_insert(struct ll_element *head, struct ll_element *tail,
35 void* new_key, void* new_data);
38 * \brief delete an element from the list.
40 bool ll_delete(struct ll_element *head, struct ll_element *tail, void* key);
43 * \brief check if the list contains an element.
45 bool ll_contains(struct ll_element *head, struct ll_element *tail, void* key);
48 * \brief print the content of the list to the screen. For debugging.
50 void ll_print(struct ll_element *head, struct ll_element *tail);
52 static inline const bool is_marked_reference(const uintptr_t p)
57 static inline const uintptr_t get_unmarked_reference(const uintptr_t p)
59 return p & 0xFFFFFFFFFFFFFFFE;
62 static inline const uintptr_t get_marked_reference(const uintptr_t p)
69 #endif /* LINKED_LIST_H_ */