X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=include%2Furcu%2Frculfhash.h;h=cbf513ec848c37744bb084a72ff66dd19f8c1816;hp=292fc0d9fc9c0fadcdd370864fe6ca249140a298;hb=d7c76f85442125bcfef40f58b1c6fc1bd5ce4ffd;hpb=48e2efad52474ba5fff6d7f452866fc8cdadab44 diff --git a/include/urcu/rculfhash.h b/include/urcu/rculfhash.h index 292fc0d..cbf513e 100644 --- a/include/urcu/rculfhash.h +++ b/include/urcu/rculfhash.h @@ -27,6 +27,7 @@ * _after_ including your URCU flavor. */ +#include #include #include #include @@ -35,6 +36,8 @@ extern "C" { #endif +struct cds_lfht; + /* * cds_lfht_node: Contains the next pointers and reverse-hash * value required for lookup and traversal of the hash table. @@ -65,6 +68,18 @@ struct cds_lfht_node { /* cds_lfht_iter: Used to track state while traversing a hash chain. */ struct cds_lfht_iter { struct cds_lfht_node *node, *next; + /* + * For debugging purposes, build both API users and rculfhash + * library with CDS_LFHT_ITER_DEBUG defined. This enables extra + * consistency checks for calls to a cds_lfht_next() or + * cds_lfht_next_duplicate() after the iterator has been + * re-purposed to iterate on a different hash table. This is a + * common programming mistake when performing hash table lookup + * nested in a hash table traversal. + */ +#ifdef CONFIG_CDS_LFHT_ITER_DEBUG + struct cds_lfht *lfht; +#endif }; static inline @@ -73,7 +88,6 @@ struct cds_lfht_node *cds_lfht_iter_get_node(struct cds_lfht_iter *iter) return iter->node; } -struct cds_lfht; struct rcu_flavor_struct; /*