1 #ifndef RBX_LINKEDLIST_HPP
2 #define RBX_LINKEDLIST_HPP
4 #include "spinlock.hpp"
33 void set_next(Node
* n
) {
37 void set_prev(Node
* n
) {
41 void remove_linkage() {
43 assert(next_
->prev() == this);
44 next_
->set_prev(prev_
);
48 assert(prev_
->next() == this);
49 prev_
->set_next(next_
);
60 locks::spinlock_mutex lock_
;
70 std::lock_guard
<locks::spinlock_mutex
> guard(lock_
);
76 std::lock_guard
<locks::spinlock_mutex
> guard(lock_
);
85 template <typename Roots
, typename Root
>
91 Iterator(Roots
& roots
)
93 , current_(roots
.front())
101 current_
= static_cast<Root
*>(current_
->next());
104 Root
* operator->() const {
108 Root
* current() const {
113 Root
* ret
= current_
;
115 current_
= static_cast<Root
*>(current_
->next());