[Sheepdog] [PATCH] collie: fix counting the number of worker threads

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Apr 13 11:08:54 CEST 2010


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 collie/work.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/collie/work.c b/collie/work.c
index 550274e..d829805 100644
--- a/collie/work.c
+++ b/collie/work.c
@@ -167,7 +167,7 @@ static void *worker_routine(void *arg)
 	int i, idx = 0;
 	sigset_t set;
 
-	for (i = 0; i < ARRAY_SIZE(wi->worker_thread); i++) {
+	for (i = 0; i < wi->nr_threads; i++) {
 		if (wi->worker_thread[i] == pthread_self()) {
 			idx = i;
 			break;
@@ -309,7 +309,7 @@ void exit_work_queue(struct work_queue *q)
 	pthread_cond_broadcast(&wi->pending_cond);
 
 	for (i = 0; wi->worker_thread[i] &&
-		     i < ARRAY_SIZE(wi->worker_thread); i++)
+		     i < wi->nr_threads; i++)
 		pthread_join(wi->worker_thread[i], NULL);
 
 	pthread_cond_destroy(&wi->pending_cond);
-- 
1.5.6.5




More information about the sheepdog mailing list