66 #include "opal_config.h"
108 #if OPAL_ENABLE_DEBUG
110 volatile int32_t opal_list_item_refcount;
112 volatile struct opal_list_t* opal_list_item_belong_to;
128 #define opal_list_get_next(item) \
129 ((item) ? ((opal_list_item_t*) ((opal_list_item_t*)(item))->opal_list_next) : NULL)
138 #define opal_list_get_prev(item) \
139 ((item) ? ((opal_list_item_t*) ((opal_list_item_t*)(item))->opal_list_prev) : NULL)
198 #
if OPAL_ENABLE_DEBUG
201 assert(1 == item->opal_list_item_refcount);
202 assert( list == item->opal_list_item_belong_to );
225 #
if OPAL_ENABLE_DEBUG
228 assert( 1 == item->opal_list_item_refcount );
229 assert( list == item->opal_list_item_belong_to );
301 #if OPAL_ENABLE_DEBUG && 0
306 size_t check_len = 0;
316 fprintf(stderr,
" Error :: opal_list_get_size - opal_list_length does not match actual list length\n");
350 #if OPAL_ENABLE_DEBUG
364 fprintf(stderr,
" Warning :: opal_list_remove_item - the item %p is not on the list %p \n",(
void*) item, (
void*) list);
369 assert( list == item->opal_list_item_belong_to );
380 #if OPAL_ENABLE_DEBUG
384 assert(0 == item->opal_list_item_refcount);
385 item->opal_list_item_belong_to = NULL;
406 #if OPAL_ENABLE_DEBUG
407 #define opal_list_append(l,i) \
408 _opal_list_append(l,i,__FILE__,__LINE__)
410 #define opal_list_append(l,i) \
411 _opal_list_append(l,i)
415 #
if OPAL_ENABLE_DEBUG
416 ,
const char* FILE_NAME,
int LINENO
421 #if OPAL_ENABLE_DEBUG
424 assert(0 == item->opal_list_item_refcount);
425 assert( NULL == item->opal_list_item_belong_to );
426 item->
super.cls_init_file_name = FILE_NAME;
427 item->
super.cls_init_lineno = LINENO;
445 #if OPAL_ENABLE_DEBUG
450 assert(1 == item->opal_list_item_refcount);
451 item->opal_list_item_belong_to = list;
473 #if OPAL_ENABLE_DEBUG
476 assert(0 == item->opal_list_item_refcount);
477 assert( NULL == item->opal_list_item_belong_to );
495 #if OPAL_ENABLE_DEBUG
500 assert(1 == item->opal_list_item_refcount);
501 item->opal_list_item_belong_to = list;
533 #if OPAL_ENABLE_DEBUG
551 #if OPAL_ENABLE_DEBUG
552 assert( list == item->opal_list_item_belong_to );
553 item->opal_list_item_belong_to = NULL;
561 assert(0 == item->opal_list_item_refcount);
595 #if OPAL_ENABLE_DEBUG
613 #if OPAL_ENABLE_DEBUG
614 assert( list == item->opal_list_item_belong_to );
621 assert(0 == item->opal_list_item_refcount);
622 item->opal_list_item_belong_to = NULL;
640 #if OPAL_ENABLE_DEBUG
644 assert(0 == item->opal_list_item_refcount);
645 assert( NULL == item->opal_list_item_belong_to );
659 #if OPAL_ENABLE_DEBUG
664 assert(1 == item->opal_list_item_refcount);
665 item->opal_list_item_belong_to = list;
static opal_list_item_t * opal_list_get_first(opal_list_t *list)
Return the first item on the list (does not remove it).
Definition: opal_list.h:195
volatile size_t opal_list_length
Quick reference to the number of items in the list.
Definition: opal_list.h:153
volatile struct opal_list_item_t * opal_list_next
Pointer to next list item.
Definition: opal_list.h:102
#define OPAL_THREAD_ADD32(x, y)
Use an atomic operation for increment/decrement if opal_using_threads() indicates that threads are in...
Definition: mutex.h:367
static opal_list_item_t * opal_list_remove_item(opal_list_t *list, opal_list_item_t *item)
Remove an item from a list.
Definition: opal_list.h:348
static opal_list_item_t * opal_list_get_last(opal_list_t *list)
Return the last item on the list (does not remove it).
Definition: opal_list.h:222
static opal_list_item_t * opal_list_get_begin(opal_list_t *list)
Return the beginning of the list; an invalid list entry suitable for comparison only.
Definition: opal_list.h:252
static bool opal_list_is_empty(opal_list_t *list)
Check for empty list.
Definition: opal_list.h:174
opal_object_t super
Generic parent class for all Open MPI objects.
Definition: opal_list.h:100
static size_t opal_list_get_size(opal_list_t *list)
Return the number of items in a list.
Definition: opal_list.h:299
OPAL_DECLSPEC void opal_list_join(opal_list_t *thislist, opal_list_item_t *pos, opal_list_t *xlist)
Join a list into another list.
Definition: opal_list.c:191
Definition: opal_list.h:98
opal_object_t super
Generic parent class for all Open MPI objects.
Definition: opal_list.h:149
static opal_list_item_t * opal_list_remove_last(opal_list_t *list)
Remove the last item from the list and return it.
Definition: opal_list.h:584
#define opal_list_get_next(item)
Get the next item in a list.
Definition: opal_list.h:128
volatile struct opal_list_item_t * opal_list_prev
Pointer to previous list item.
Definition: opal_list.h:104
Base object.
Definition: opal_object.h:182
OPAL_DECLSPEC void opal_list_splice(opal_list_t *thislist, opal_list_item_t *pos, opal_list_t *xlist, opal_list_item_t *first, opal_list_item_t *last)
Splice a list into another list.
Definition: opal_list.c:206
Definition: opal_list.h:147
OPAL_DECLSPEC bool opal_list_insert(opal_list_t *list, opal_list_item_t *item, long long idx)
Add an item to the list at a specific index location in the list.
Definition: opal_list.c:112
OPAL_DECLSPEC int opal_list_sort(opal_list_t *list, opal_list_item_compare_fn_t compare)
Sort a list with a provided compare function.
Definition: opal_list.c:231
static opal_list_item_t * opal_list_remove_first(opal_list_t *list)
Remove the first item from the list and return it.
Definition: opal_list.h:522
static void opal_list_prepend(opal_list_t *list, opal_list_item_t *item)
Prepend an item to the beginning of the list.
Definition: opal_list.h:469
int(* opal_list_item_compare_fn_t)(opal_list_item_t **a, opal_list_item_t **b)
Comparison function for opal_list_sort(), below.
Definition: opal_list.h:775
opal_list_item_t opal_list_sentinel
Head and tail item of the list.
Definition: opal_list.h:151
Mutual exclusion functions.
static void opal_list_insert_pos(opal_list_t *list, opal_list_item_t *pos, opal_list_item_t *item)
Add an item to the list before a given element.
Definition: opal_list.h:637
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
static opal_list_item_t * opal_list_get_end(opal_list_t *list)
Return the end of the list; an invalid list entry suitable for comparison only.
Definition: opal_list.h:274