Skip to content

master: Add volatile to the pointers in the list_item structures. #3468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions opal/class/opal_lifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ union opal_counted_pointer_t {
/** update counter used when cmpset_128 is available */
uint64_t counter;
/** list item pointer */
opal_list_item_t *item;
volatile opal_list_item_t * volatile item;
} data;
#if OPAL_HAVE_ATOMIC_CMPSET_128 && HAVE_OPAL_INT128_T
/** used for atomics when there is a cmpset that can operate on
Expand Down Expand Up @@ -138,14 +138,14 @@ static inline opal_list_item_t *opal_lifo_push_atomic (opal_lifo_t *lifo,
*/
static inline opal_list_item_t *opal_lifo_pop_atomic (opal_lifo_t* lifo)
{
opal_counted_pointer_t old_head;
opal_list_item_t *item;

do {
opal_counted_pointer_t old_head;

old_head.data.counter = lifo->opal_lifo_head.data.counter;
opal_atomic_rmb ();
item = old_head.data.item = lifo->opal_lifo_head.data.item;
old_head.data.item = item = (opal_list_item_t*)lifo->opal_lifo_head.data.item;

if (item == &lifo->opal_lifo_ghost) {
return NULL;
Expand Down
4 changes: 2 additions & 2 deletions opal/class/opal_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ struct opal_list_item_t
{
opal_object_t super;
/**< Generic parent class for all Open MPI objects */
volatile struct opal_list_item_t *opal_list_next;
volatile struct opal_list_item_t * volatile opal_list_next;
/**< Pointer to next list item */
volatile struct opal_list_item_t *opal_list_prev;
volatile struct opal_list_item_t * volatile opal_list_prev;
/**< Pointer to previous list item */
int32_t item_free;

Expand Down