opal_lifo: fix one more potential issue with the new 128-bit lifo atomics
It is possible the compiler can reorder the read of the head item and the head itself. This could lead to a situation where the item returned was not really the head item.
Этот коммит содержится в:
родитель
a40fe8311f
Коммит
52ed5a9bf8
@ -139,8 +139,10 @@ static inline opal_list_item_t *opal_lifo_pop_atomic (opal_lifo_t* lifo)
|
|||||||
do {
|
do {
|
||||||
opal_counted_pointer_t old_head;
|
opal_counted_pointer_t old_head;
|
||||||
|
|
||||||
|
opal_atomic_rmb ();
|
||||||
|
|
||||||
old_head.value = lifo->opal_lifo_head.value;
|
old_head.value = lifo->opal_lifo_head.value;
|
||||||
item = (opal_list_item_t *) lifo->opal_lifo_head.data.item;
|
item = old_head.data.item;
|
||||||
|
|
||||||
if (item == &lifo->opal_lifo_ghost) {
|
if (item == &lifo->opal_lifo_ghost) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user