THREADS: config setting min_workers _now_ also is that, plus its also max_spare_workers
[citadel.git] / citadel / sysdep.c
index 4ea07f3edcd95ffc34802439689098d83d7245c8..01e7e831d49ddcd5de11b260bac2e02e29c60acd 100644 (file)
@@ -1381,7 +1381,8 @@ SKIP_SELECT:
 
                pthread_mutex_lock(&ThreadCountMutex);
                --active_workers;
 
                pthread_mutex_lock(&ThreadCountMutex);
                --active_workers;
-               if (active_workers + config.c_min_workers < num_workers)
+               if ((active_workers + config.c_min_workers < num_workers) &&
+                   (num_workers > config.c_min_workers))
                {
                        num_workers--;
                        pthread_mutex_unlock(&ThreadCountMutex);
                {
                        num_workers--;
                        pthread_mutex_unlock(&ThreadCountMutex);