From 89aca153336105c0f29903e31ebb6bd743d95307 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Mon, 12 Nov 2007 19:58:46 -0800 Subject: [PATCH] Removing memory issue/cleanup for threads in src/memslap.c --- src/memslap.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/memslap.c b/src/memslap.c index 58150159..487b6023 100644 --- a/src/memslap.c +++ b/src/memslap.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -313,6 +314,7 @@ void *run_task(void *p) unsigned int value= 1; memc= memcached_create(NULL); + WATCHPOINT_ASSERT(memc); if (opt_non_blocking_io) memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, &value); if (opt_tcp_nodelay) @@ -338,16 +340,17 @@ void *run_task(void *p) break; } - pthread_mutex_lock(&counter_mutex); - thread_counter--; - pthread_cond_signal(&count_threshhold); - pthread_mutex_unlock(&counter_mutex); memcached_free(memc); if (context->execute_pairs) pairs_free(context->execute_pairs); free(context); + pthread_mutex_lock(&counter_mutex); + thread_counter--; + pthread_cond_signal(&count_threshhold); + pthread_mutex_unlock(&counter_mutex); + return NULL; } -- 2.30.2