Avoid setting both el->prev and el->next on the same line.
The goal is to set both el->prev and el->next to el, but a naive
compiler, such as when we're using -O0, will set el->next first, then
will set el->prev to the value of el->next, but if we're unlucky,
el->next will have been set to something else by another thread.
So explicitely set both to what we want.
This should be backported up to 2.8.
*/
static inline struct mt_list *mt_list_init(struct mt_list *el)
{
- el->next = el->prev = el;
+ el->next = el;
+ el->prev = el;
return el;
}
break;
}
- lh->next = lh->prev = lh;
+ lh->next = lh;
+ lh->prev = lh;
__atomic_thread_fence(__ATOMIC_RELEASE);
n->prev = p;
* somebody may be using it already.
*/
if (el != n) {
- el->prev = el->next = el;
+ el->prev = el;
+ el->next = el;
__atomic_thread_fence(__ATOMIC_RELEASE);
}