[sheepdog] [PATCH 1/4] worker: remove unused wq_state

Liu Yuan namei.unix at gmail.com
Tue Apr 16 10:37:51 CEST 2013


From: Liu Yuan <tailai.ly at taobao.com>

wq_state isn't used at all. It is non-sense to keep it in the code.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/work.c |   11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/sheep/work.c b/sheep/work.c
index 2e1c8f0..e71afbc 100644
--- a/sheep/work.c
+++ b/sheep/work.c
@@ -46,10 +46,6 @@ static int efd;
 int total_ordered_workers;
 LIST_HEAD(worker_info_list);
 
-enum wq_state {
-	WQ_DEAD = (1U << 1),
-};
-
 static void *worker_routine(void *arg);
 
 static uint64_t get_msec_time(void)
@@ -193,7 +189,7 @@ static void *worker_routine(void *arg)
 	wi->nr_running++;
 	pthread_mutex_unlock(&wi->pending_lock);
 
-	while (!(wi->q.wq_state & WQ_DEAD)) {
+	while (true) {
 
 		pthread_mutex_lock(&wi->pending_lock);
 		if (wq_need_shrink(wi)) {
@@ -209,10 +205,6 @@ retest:
 		if (list_empty(&wi->q.pending_list)) {
 			wi->nr_running--;
 			pthread_cond_wait(&wi->pending_cond, &wi->pending_lock);
-			if (wi->q.wq_state & WQ_DEAD) {
-				pthread_mutex_unlock(&wi->pending_lock);
-				pthread_exit(NULL);
-			}
 			wi->nr_running++;
 			goto retest;
 		}
@@ -294,7 +286,6 @@ struct work_queue *init_work_queue(const char *name, enum wq_thread_control tc)
 
 	return &wi->q;
 destroy_threads:
-	wi->q.wq_state |= WQ_DEAD;
 	pthread_mutex_unlock(&wi->startup_lock);
 	pthread_cond_destroy(&wi->pending_cond);
 	pthread_mutex_destroy(&wi->pending_lock);
-- 
1.7.9.5




More information about the sheepdog mailing list