RBtree: Only execute usleep() in debug mode
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 30 May 2011 18:50:48 +0000 (14:50 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 30 May 2011 18:50:48 +0000 (14:50 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-rbtree.c

index a079d31cd1ff1f59cbd0264f3d66084048b21ad6..bdade35758aedbd7a4946318227f86d3491dab2a 100644 (file)
 
 #ifdef DEBUG
 #define dbg_printf(args...)    printf(args)
+#define dbg_usleep(usecs)      usleep(usecs)
 #else
 #define dbg_printf(args...)
+#define dbg_usleep(usecs)
 #endif
 
 /*
@@ -392,7 +394,7 @@ struct rcu_rbtree_node *rcu_rbtree_search(struct rcu_rbtree *rbtree,
        int comp;
 
        while (!rcu_rbtree_is_nil(x) && (comp = rbtree->comp(k, x->key)) != 0) {
-               usleep(10);
+               dbg_usleep(10);
                if (comp < 0)
                        x = rcu_dereference(x->_left);
                else
@@ -412,7 +414,7 @@ struct rcu_rbtree_node *rcu_rbtree_search_min(struct rcu_rbtree *rbtree,
                (unsigned long) x->key,
                (unsigned long) range_low, (unsigned long) range_high);
        while (!rcu_rbtree_is_nil(x)) {
-               usleep(10);
+               dbg_usleep(10);
                xl = rcu_dereference(x->_left);
                dbg_printf("search min x %lx\n", (unsigned long) x->key);
                dbg_printf("search min xl %lx\n", (unsigned long) xl->key);
@@ -447,7 +449,7 @@ struct rcu_rbtree_node *rcu_rbtree_search_max(struct rcu_rbtree *rbtree,
                (unsigned long) x->key,
                (unsigned long) range_low, (unsigned long) range_high);
        while (!rcu_rbtree_is_nil(x)) {
-               usleep(10);
+               dbg_usleep(10);
                xr = rcu_dereference(x->_right);
                dbg_printf("search max x %lx\n", (unsigned long) x->key);
                dbg_printf("search max xl %lx\n", (unsigned long) xr->key);
This page took 0.025838 seconds and 4 git commands to generate.