Catch corner cases
authoraland <aland>
Fri, 3 Aug 2007 19:51:49 +0000 (19:51 +0000)
committeraland <aland>
Fri, 3 Aug 2007 19:51:49 +0000 (19:51 +0000)
src/main/threads.c

index 07fa0ec..ab0078f 100644 (file)
@@ -756,6 +756,16 @@ int thread_pool_init(int spawn_flag)
        }
 
        /*
+        *      Catch corner cases.
+        */
+       if (thread_pool.min_spare_threads < 1)
+               thread_pool.min_spare_threads = 1;
+       if (thread_pool.max_spare_threads < 1)
+               thread_pool.max_spare_threads = 1;
+       if (thread_pool.max_spare_threads < thread_pool.min_spare_threads)
+               thread_pool.max_spare_threads = thread_pool.min_spare_threads;
+
+       /*
         *      The pool has already been initialized.  Don't spawn
         *      new threads, and don't forget about forked children,
         */