Don't add extra threads for single-threaded decompression case.

This commit is contained in:
Con Kolivas 2011-02-22 00:58:55 +11:00
parent bb33f7571c
commit bcb857d934

View file

@ -842,8 +842,11 @@ void *open_stream_in(int f, int n)
return NULL; return NULL;
/* We have one thread dedicated to stream 0, and one more thread than /* We have one thread dedicated to stream 0, and one more thread than
* CPUs to keep them busy. */ * CPUs to keep them busy, unless we're running single-threaded. */
if (control.threads > 1)
total_threads = control.threads + 2; total_threads = control.threads + 2;
else
total_threads = control.threads + 1;
threads = calloc(sizeof(pthread_t), total_threads); threads = calloc(sizeof(pthread_t), total_threads);
if (unlikely(!threads)) if (unlikely(!threads))
return NULL; return NULL;