X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Frculfhash.h;h=9934422ee9d6e1a4e737da18c73ba14c54dbbff7;hp=afd0c3eafb34aff325843ea476b4714d90e86fe5;hb=a59f39055b5ecb77b68cf78b9839aa9e8e4ec332;hpb=a22bf98bc1ceccb8ba89dfdf73425dea77e60ae8 diff --git a/urcu/rculfhash.h b/urcu/rculfhash.h index afd0c3e..9934422 100644 --- a/urcu/rculfhash.h +++ b/urcu/rculfhash.h @@ -133,7 +133,8 @@ struct cds_lfht *_cds_lfht_new(unsigned long init_size, * @min_nr_alloc_buckets: the minimum number of allocated buckets. * (must be power of two) * @max_nr_buckets: the maximum number of hash table buckets allowed. - * (must be power of two) + * (must be power of two, 0 is accepted, means + * "infinite") * @flags: hash table creation flags (can be combined with bitwise or: '|'). * 0: no flags. * CDS_LFHT_AUTO_RESIZE: automatically resize hash table. @@ -297,7 +298,7 @@ void cds_lfht_add(struct cds_lfht *ht, unsigned long hash, * Return the unique node already present upon failure. If * cds_lfht_add_unique fails, the node passed as parameter should be * freed by the caller. In this case, the caller does NOT need to wait - * for a grace period before freeing the node. + * for a grace period before freeing or re-using the node. * Call with rcu_read_lock held. * Threads calling this API need to be registered RCU read-side threads. * @@ -333,7 +334,7 @@ struct cds_lfht_node *cds_lfht_add_unique(struct cds_lfht *ht, * Call with rcu_read_lock held. * Threads calling this API need to be registered RCU read-side threads. * After successful replacement, a grace period must be waited for before - * freeing the memory reserved for the returned node. + * freeing or re-using the memory reserved for the returned node. * * The semantic of replacement vs lookups and traversals is the * following: if lookups and traversals are performed between a key @@ -375,8 +376,8 @@ struct cds_lfht_node *cds_lfht_add_replace(struct cds_lfht *ht, * Call with rcu_read_lock held. * Threads calling this API need to be registered RCU read-side threads. * After successful replacement, a grace period must be waited for before - * freeing the memory reserved for the old node (which can be accessed - * with cds_lfht_iter_get_node). + * freeing or re-using the memory reserved for the old node (which can + * be accessed with cds_lfht_iter_get_node). * * The semantic of replacement vs lookups is the same as * cds_lfht_add_replace(). @@ -408,8 +409,8 @@ int cds_lfht_replace(struct cds_lfht *ht, * Call with rcu_read_lock held. * Threads calling this API need to be registered RCU read-side threads. * After successful removal, a grace period must be waited for before - * freeing the memory reserved for old node (which can be accessed with - * cds_lfht_iter_get_node). + * freeing or re-using the memory reserved for old node (which can be + * accessed with cds_lfht_iter_get_node). * Upon success, this function issues a full memory barrier before and * after its atomic commit. Upon failure, this function does not issue * any memory barrier. @@ -470,7 +471,7 @@ void cds_lfht_resize(struct cds_lfht *ht, unsigned long new_size); for (cds_lfht_first(ht, iter), \ pos = caa_container_of(cds_lfht_iter_get_node(iter), \ __typeof__(*(pos)), member); \ - &(pos)->member != NULL; \ + cds_lfht_iter_get_node(iter) != NULL; \ cds_lfht_next(ht, iter), \ pos = caa_container_of(cds_lfht_iter_get_node(iter), \ __typeof__(*(pos)), member)) @@ -480,7 +481,7 @@ void cds_lfht_resize(struct cds_lfht *ht, unsigned long new_size); for (cds_lfht_lookup(ht, hash, match, key, iter), \ pos = caa_container_of(cds_lfht_iter_get_node(iter), \ __typeof__(*(pos)), member); \ - &(pos)->member != NULL; \ + cds_lfht_iter_get_node(iter) != NULL; \ cds_lfht_next_duplicate(ht, match, key, iter), \ pos = caa_container_of(cds_lfht_iter_get_node(iter), \ __typeof__(*(pos)), member))