https://www.liblfds.org/mediawiki/index.php?title=r7.1.0:Function_lfds710_list_aso_init_valid_on_current_logical_core&feed=atom&action=historyr7.1.0:Function lfds710 list aso init valid on current logical core - Revision history2024-03-29T09:42:47ZRevision history for this page on the wikiMediaWiki 1.36.0https://www.liblfds.org/mediawiki/index.php?title=r7.1.0:Function_lfds710_list_aso_init_valid_on_current_logical_core&diff=688&oldid=prevAdmin at 18:21, 30 May 20162016-05-30T18:21:02Z<p></p>
<p><b>New page</b></p><div>{{DISPLAYTITLE:function lfds710_list_aso_init_valid_on_current_logical_core}}<br />
==Source Files==<br />
└───liblfds710<br />
├───inc<br />
│ └───liblfds710<br />
│ lfds710_list_addonly_singlylinked._orderedh<br />
└───src<br />
└───llfds710_list_addonly_singlylinked_ordered<br />
lfds710_list_addonly_singlylinked_ordered_init.c<br />
<br />
==Enums==<br />
enum [[r7.1.0:enum lfds710_list_aso_existing_key|lfds710_list_aso_existing_key]]<br />
{<br />
LFDS710_LIST_ASO_EXISTING_KEY_OVERWRITE,<br />
LFDS710_LIST_ASO_EXISTING_KEY_FAIL<br />
};<br />
<br />
==Opaque Structures==<br />
struct [[r7.1.0:struct lfds710_list_aso_state|lfds710_list_aso_state]];<br />
<br />
==Prototype==<br />
void lfds710_list_aso_init( struct lfds710_list_aso_state *lasos,<br />
int (*key_compare_function)(void const *new_key, void const *existing_key),<br />
enum lfds710_list_aso_existing_key existing_key,<br />
void *user_state );<br />
<br />
==Parameters==<br />
''struct lfds710_list_aso_state *lasos''<br />
: A pointer to a user-allocated ''LFDS710_PAL_ATOMIC_ISOLATION_IN_BYTES'' aligned ''struct lfds710_list_aso_state''. Stack declared variables will automatically be correctly aligned by the compiler, due to the information in the structure definitions; nothing has to be done. Heap allocated variables however will by no means be correctly aligned and an aligned malloc must be used.<br />
<br />
''int (*key_compare_function)(void const *new_key, void const *existing_key)''<br />
: A callback used by the list to compare keys. The callback returns 0 if the keys are equal, smaller than zero if ''new_key'' is smaller than ''existing_key'' and greater than zero if ''new_key'' is greater than ''existing_key'' (i.e. as ''strcmp'').<br />
<br />
''enum lfds710_list_aso_existing_key existing_key''<br />
: This argument specifies how the list should behave when attempting to add a key which already exists (see Notes).<br />
<br />
''void *user_state''<br />
: A pointer to void, supplied by the user, which is returned to the user in various callback functions, permitting the user to pass his own state into those functions. This argument can be NULL.<br />
<br />
==Notes==<br />
As the function name indicates, the initialization work performed on the list state is only valid on the current logical core. To make this work valid on other logical cores, threads on other cores must call ''[[r7.1.0:define LFDS710_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE|LFDS710_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE]]''.<br />
<br />
This function instantiates an add-only, ordered, singly-linked list by initializing the list state. The caller is responsible for all memory allocation and, after ''lfds710_list_aso_cleanup'' is called, for all deallocation.<br />
<br />
The ''existing_key'' argument specifies how ''lfds710_list_aso_insert'' should behave when the attempt is made to add a new element which has a key which is already present in the btree.<br />
<br />
If ''LFDS710_LIST_ASO_EXISTING_KEY_FAIL'' is specified, ''lfds710_list_aso_insert'' will fail, and return ''LFDS710_LIST_ASO_LINK_RESULT_FAILURE_EXISTING_KEY''.<br />
<br />
If ''LFDS710_LIST_ASO_EXISTING_KEY_OVERWRITE'' is specified, the attempt will cause the value in the new element to over-write that of the existing element, and ''lfds710_list_aso_insert'' will return ''LFDS710_LIST_ASO_LINK_RESULT_SUCCESS_OVERWRITE''.<br />
<br />
(In both cases, when a linking a key which is not present in the list, ''LFDS710_BTREE_AU_LINK_RESULT_SUCCESS'' is returned.)<br />
<br />
==See Also==<br />
* [[r7.1.0:List (add-only, singly-linked, ordered)|List (add-only, singly-linked, ordered)]]<br />
* ''[[r7.1.0:function lfds710_list_aso_cleanup|lfds710_list_aso_cleanup]]''</div>Admin