From 5e723bc6f122223252b8d3c67b7b1f17121dd49a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 22 Jun 2018 00:04:48 +0200 Subject: [PATCH] pthreadpool: use unsigned for num_idle, num_threads and max_threads These can't get negative. Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- lib/pthreadpool/pthreadpool.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pthreadpool/pthreadpool.c b/lib/pthreadpool/pthreadpool.c index 92a88c9ca84..0ab6f63dbf4 100644 --- a/lib/pthreadpool/pthreadpool.c +++ b/lib/pthreadpool/pthreadpool.c @@ -78,17 +78,17 @@ struct pthreadpool { /* * maximum number of threads */ - int max_threads; + unsigned max_threads; /* * Number of threads */ - int num_threads; + unsigned num_threads; /* * Number of idle threads */ - int num_idle; + unsigned num_idle; /* * Condition variable indicating that helper threads should @@ -206,7 +206,7 @@ static void pthreadpool_prepare_pool(struct pthreadpool *pool) assert(ret == 0); while (pool->num_idle != 0) { - int num_idle = pool->num_idle; + unsigned num_idle = pool->num_idle; pthread_cond_t prefork_cond; ret = pthread_cond_init(&prefork_cond, NULL); -- 2.47.3