Update
[gdb.git] / gdb / osf-share / cma_list.h
blob463fa49870f21cddc7dd4e16eb3f358df09b1728
1 /*
2 * (c) Copyright 1990-1996 OPEN SOFTWARE FOUNDATION, INC.
3 * (c) Copyright 1990-1996 HEWLETT-PACKARD COMPANY
4 * (c) Copyright 1990-1996 DIGITAL EQUIPMENT CORPORATION
5 * (c) Copyright 1991, 1992 Siemens-Nixdorf Information Systems
6 * To anyone who acknowledges that this file is provided "AS IS" without
7 * any express or implied warranty: permission to use, copy, modify, and
8 * distribute this file for any purpose is hereby granted without fee,
9 * provided that the above copyright notices and this notice appears in
10 * all source code copies, and that none of the names listed above be used
11 * in advertising or publicity pertaining to distribution of the software
12 * without specific, written prior permission. None of these organizations
13 * makes any representations about the suitability of this software for
14 * any purpose.
17 * Header file for generic list functions operating on singly linked
18 * null-terminated lists. Items may not be REMOVED from the list! The
19 * intent is that the list can be traversed (for read-only operations)
20 * without locking, since insertion is "safe" (though not truely
21 * atomic). THIS ASSUMES THAT THE HARDWARE MAKES WRITES VISIBLE TO READS
22 * IN THE ORDER IN WHICH THEY OCCURRED! WITHOUT SUCH READ/WRITE
23 * ORDERING, IT MAY BE NECESSARY TO INSERT "BARRIERS" TO PRODUCE THE
24 * REQUIRED VISIBILITY!
27 #ifndef CMA_LIST
28 #define CMA_LIST
31 * INCLUDE FILES
34 #include <cma.h>
37 * CONSTANTS AND MACROS
40 #define cma__c_null_list ((cma__t_list *)cma_c_null_ptr)
43 * Test whether a list is empty. Return cma_c_true if so, else
44 * cma_c_false.
46 #define cma__list_empty(head) ((head)->link == cma__c_null_list)
49 * Initialize a queue header to empty.
51 #define cma__list_init(head) (void)((head)->link = cma__c_null_list)
54 * Insert an element in a list following the specified item (or at the
55 * beginning of the list if "list" is the list head). NOTE: insertion
56 * operations should be interlocked by the caller!
58 #define cma__list_insert(element,list) (void)( \
59 (element)->link = (list)->link, \
60 (list)->link = (element))
63 * Return the next item in a list (or the first, if the address is of the
64 * list header)
66 #define cma__list_next(element) ((element)->link)
69 * TYPEDEFS
72 typedef struct CMA__T_LIST {
73 struct CMA__T_LIST *link; /* Forward link */
74 } cma__t_list;
77 * GLOBAL DATA
81 * INTERNAL INTERFACES
84 #endif