From ee663bc7123495504de8852766eb34dbe85665e1 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sat, 8 Nov 2008 22:57:38 +0000 Subject: [PATCH] rrdcached: move queue length decrement into remove_from_queue -- kevin git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1661 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_daemon.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/program/src/rrd_daemon.c b/program/src/rrd_daemon.c index d56cf06d..97eed320 100644 --- a/program/src/rrd_daemon.c +++ b/program/src/rrd_daemon.c @@ -587,6 +587,12 @@ static void remove_from_queue(cache_item_t *ci) /* {{{ */ ci->next = ci->prev = NULL; ci->flags &= ~CI_FLAGS_IN_QUEUE; + + pthread_mutex_lock (&stats_lock); + assert (stats_queue_length > 0); + stats_queue_length--; + pthread_mutex_unlock (&stats_lock); + } /* }}} static void remove_from_queue */ /* free the resources associated with the cache_item_t @@ -846,11 +852,6 @@ static void *queue_thread_main (void *args __attribute__((unused))) /* {{{ */ wipe_ci_values(ci, time(NULL)); remove_from_queue(ci); - pthread_mutex_lock (&stats_lock); - assert (stats_queue_length > 0); - stats_queue_length--; - pthread_mutex_unlock (&stats_lock); - pthread_mutex_unlock (&cache_lock); rrd_clear_error (); -- 2.30.2