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_
17 #include <sys/cdefs.h>
22 struct ll_element *next;
28 * \brief create a new (empty) linked list. Creation is not thread-safe.
30 void ll_create(struct ll_element **head, struct ll_element **tail);
33 * \brief insert a new element into the linked list.
35 bool ll_insert(struct ll_element *head, struct ll_element *tail,
36 void* new_key, void* new_data);
39 * \brief delete an element from the list.
41 bool ll_delete(struct ll_element *head, struct ll_element *tail, void* key);
44 * \brief check if the list contains an element.
46 bool ll_contains(struct ll_element *head, struct ll_element *tail, void* key);
49 * \brief print the content of the list to the screen. For debugging.
51 void ll_print(struct ll_element *head, struct ll_element *tail);
53 static inline const bool is_marked_reference(const uintptr_t p)
58 static inline const uintptr_t get_unmarked_reference(const uintptr_t p)
60 return p & 0xFFFFFFFFFFFFFFFE;
63 static inline const uintptr_t get_marked_reference(const uintptr_t p)
70 #endif /* LINKED_LIST_H_ */