Skip to content

Commit 4da9a3d

Browse files
authored
Merge pull request #3494 from jsquyres/pr/v2.1.x/opal-list-item-volatile
v2.1.x: Add volatile to the pointer in the list_item structure
2 parents dbf044a + 4697061 commit 4da9a3d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

opal/class/opal_lifo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ union opal_counted_pointer_t {
4646
/** update counter used when cmpset_128 is available */
4747
uint64_t counter;
4848
/** list item pointer */
49-
opal_list_item_t *item;
49+
volatile opal_list_item_t * volatile item;
5050
} data;
5151
#if OPAL_HAVE_ATOMIC_CMPSET_128 && HAVE_OPAL_INT128_T
5252
/** used for atomics when there is a cmpset that can operate on
@@ -134,14 +134,14 @@ static inline opal_list_item_t *opal_lifo_push_atomic (opal_lifo_t *lifo,
134134
*/
135135
static inline opal_list_item_t *opal_lifo_pop_atomic (opal_lifo_t* lifo)
136136
{
137+
opal_counted_pointer_t old_head;
137138
opal_list_item_t *item;
138139

139140
do {
140-
opal_counted_pointer_t old_head;
141141

142142
old_head.data.counter = lifo->opal_lifo_head.data.counter;
143143
opal_atomic_rmb ();
144-
item = old_head.data.item = lifo->opal_lifo_head.data.item;
144+
old_head.data.item = item = (opal_list_item_t*)lifo->opal_lifo_head.data.item;
145145

146146
if (item == &lifo->opal_lifo_ghost) {
147147
return NULL;

opal/class/opal_list.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ struct opal_list_item_t
101101
{
102102
opal_object_t super;
103103
/**< Generic parent class for all Open MPI objects */
104-
volatile struct opal_list_item_t *opal_list_next;
104+
volatile struct opal_list_item_t * volatile opal_list_next;
105105
/**< Pointer to next list item */
106-
volatile struct opal_list_item_t *opal_list_prev;
106+
volatile struct opal_list_item_t * volatile opal_list_prev;
107107
/**< Pointer to previous list item */
108108
int32_t item_free;
109109

0 commit comments

Comments
 (0)