X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fbin%2Fmemaslap%2Fms_thread.c;h=cfd46de3449817081092e0c34918981cef7d061c;hb=cb40bfe8923a2b06160a965d95b45ca0ea3421ab;hp=b06aa526254c96a2b15a3642894ba4371c87635a;hpb=db80327002e27589b29fe4bf353202904f373171;p=awesomized%2Flibmemcached diff --git a/src/bin/memaslap/ms_thread.c b/src/bin/memaslap/ms_thread.c index b06aa526..cfd46de3 100644 --- a/src/bin/memaslap/ms_thread.c +++ b/src/bin/memaslap/ms_thread.c @@ -188,7 +188,7 @@ static int ms_setup_thread(ms_thread_ctx_t *thread_ctx) { for (uint32_t i = 0; i < thread_ctx->nconns; i++) { ms_thread->conn[i].conn_idx = i; - if (ms_setup_conn(&ms_thread->conn[i]) != 0) { + if (ms_setup_conn(&ms_thread->conn[i])) { /* only output this error once */ if (atomic_add_32_nv(&cnt, 1) == 0) { fprintf(stderr, "Initializing connection failed.\n"); @@ -220,7 +220,7 @@ static void *ms_worker_libevent(void *arg) { ms_set_thread_cpu_affinity(thread_ctx->thd_idx % ms_setting.ncpu); } - if (ms_setup_thread(thread_ctx) != 0) { + if (ms_setup_thread(thread_ctx)) { exit(1); } @@ -251,7 +251,7 @@ static void ms_create_worker(void *(*func)(void *), void *arg) { pthread_attr_init(&attr); - if ((ret = pthread_create(&thread, &attr, func, arg)) != 0) { + if ((ret = pthread_create(&thread, &attr, func, arg))) { fprintf(stderr, "Can't create thread: %s.\n", strerror(ret)); exit(1); } @@ -292,7 +292,7 @@ void ms_thread_init() { /* cleanup some resource of threads when all the threads exit */ void ms_thread_cleanup() { - if (ms_thread_ctx != NULL) { + if (ms_thread_ctx) { free(ms_thread_ctx); } pthread_key_delete(ms_thread_key);