pthreadpool: use unsigned for num_idle, num_threads and max_threads
authorStefan Metzmacher <metze@samba.org>
Thu, 21 Jun 2018 22:04:48 +0000 (00:04 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 12 Jul 2018 12:25:18 +0000 (14:25 +0200)
These can't get negative.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
lib/pthreadpool/pthreadpool.c

index 92a88c9ca849e7236efde474b4b5dc9561f682ef..0ab6f63dbf425f74e53f4918f3ba96e9c2581d3b 100644 (file)
@@ -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);