projects
/
awesomized
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (from parent 1:
324445c
)
Removing memory issue/cleanup for threads in src/memslap.c
author
Brian Aker
<brian@tangent.org>
Tue, 13 Nov 2007 03:58:46 +0000
(19:58 -0800)
committer
Brian Aker
<brian@tangent.org>
Tue, 13 Nov 2007 03:58:46 +0000
(19:58 -0800)
src/memslap.c
patch
|
blob
|
history
diff --git
a/src/memslap.c
b/src/memslap.c
index 5815015905d90fa7547f21a2735ee3f12ddfefe7..487b60230f11ddf7842b60346e75a41e0f2dfe29 100644
(file)
--- a/
src/memslap.c
+++ b/
src/memslap.c
@@
-6,6
+6,7
@@
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
+#include <assert.h>
#include <sys/time.h>
#include <getopt.h>
#include <pthread.h>
#include <sys/time.h>
#include <getopt.h>
#include <pthread.h>
@@
-313,6
+314,7
@@
void *run_task(void *p)
unsigned int value= 1;
memc= memcached_create(NULL);
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)
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;
}
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);
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;
}
return NULL;
}