Skip to content

Commit 7f761d8

Browse files
committed
opal_free_list: use lifo atomic functions in opal_free_list_wait_mt
This commit fixes a multi-threading bug when using the thread-safe free list functions. opal_free_list_wait_mt() was using the conditional version of opal_lifo_pop() and not the thread-safe call. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 19e85a3 commit 7f761d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

opal/class/opal_free_list.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static inline opal_free_list_item_t *opal_free_list_get (opal_free_list_t *flist
248248
static inline opal_free_list_item_t *opal_free_list_wait_mt (opal_free_list_t *fl)
249249
{
250250
opal_free_list_item_t *item =
251-
(opal_free_list_item_t *) opal_lifo_pop (&fl->super);
251+
(opal_free_list_item_t *) opal_lifo_pop_atomic (&fl->super);
252252

253253
while (NULL == item) {
254254
if (!opal_mutex_trylock (&fl->fl_lock)) {
@@ -274,7 +274,7 @@ static inline opal_free_list_item_t *opal_free_list_wait_mt (opal_free_list_t *f
274274
opal_mutex_lock (&fl->fl_lock);
275275
}
276276
opal_mutex_unlock (&fl->fl_lock);
277-
item = (opal_free_list_item_t *) opal_lifo_pop (&fl->super);
277+
item = (opal_free_list_item_t *) opal_lifo_pop_atomic (&fl->super);
278278
}
279279

280280
return item;

0 commit comments

Comments
 (0)