From: Brian Aker Date: Tue, 13 Nov 2007 03:58:46 +0000 (-0800) Subject: Removing memory issue/cleanup for threads in src/memslap.c X-Git-Tag: 0.10~17 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=89aca153336105c0f29903e31ebb6bd743d95307;p=awesomized%2Flibmemcached Removing memory issue/cleanup for threads in src/memslap.c --- 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; }