From: Mathieu Desnoyers Date: Mon, 30 May 2011 18:50:48 +0000 (-0400) Subject: RBtree: Only execute usleep() in debug mode X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9c161ee1446b51800d48d5242959c9cc23c7b9ed;p=userspace-rcu.git RBtree: Only execute usleep() in debug mode Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu-rbtree.c b/urcu-rbtree.c index a079d31..bdade35 100644 --- a/urcu-rbtree.c +++ b/urcu-rbtree.c @@ -43,8 +43,10 @@ #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);