cp_hashlist_set_mode(3) - Linux man page
Name
cp_hashlist_set_mode, cp_hashlist_unset_mode - set/unset hashlist mode bitsSynopsis
#include <cprops/hashlist.h>int cp_hashlist_set_mode(cp_hashlist *list, int mode);
int cp_hashlist_unset_mode(cp_hashlist *list, int mode);
Description
- COLLECTION_MODE_COPY - on insertion, the applicable copy functions
- specified are used to store copies of the key and value.
- COLLECTION_MODE_DEEP - when removing or replacing a mapping, the
- destructor functions are called on the key and value constituting the mapping.
- COLLECTION_MODE_MULTIPLE_VALUES - allows multiple mappings for a given
- key on insertion. When retrieving values the results are given in a newly allocated cp_list, even if it contains only one entry.
libcprops may be configured with multiple values options disabled. In this event setting this bit will have no effect.
- COLLECTION_MODE_NOSYNC - operations are performed with no locking.
- Synchronization features should not be used on tables created in this mode.
- COLLECTION_MODE_NORESIZE - the table is not extended on insertion nor
- compacted on removal regardless of maximal and minimal fill factor settings.
- COLLECTION_MODE_LIST_ORDER - when retrieving multiple values with the
- COLLECTION_MODE_MULTIPLE_VALUES bit set, values are returned in their order in the list rather than in insertion order. This operation is O(n) as opposed to O(m) where N is the total number of entries in the list and m is the number of matches for the requested key.
Return Value
cp_hashlist_set_mode returns 0 on success, -1 on locking failure or EINVAL if attempting to set COLLECTION_MODE_NOSYNC while the current thread owns the list lock.cp_hashlist_unset_mode returns 0 on success or -1 on locking failure.