From bcb857d9343b0c96d63ba4d6ca71a6df24a80863 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 22 Feb 2011 00:58:55 +1100 Subject: [PATCH] Don't add extra threads for single-threaded decompression case. --- stream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stream.c b/stream.c index 1fef9fa..d9ee835 100644 --- a/stream.c +++ b/stream.c @@ -842,8 +842,11 @@ void *open_stream_in(int f, int n) return NULL; /* We have one thread dedicated to stream 0, and one more thread than - * CPUs to keep them busy. */ - total_threads = control.threads + 2; + * CPUs to keep them busy, unless we're running single-threaded. */ + if (control.threads > 1) + total_threads = control.threads + 2; + else + total_threads = control.threads + 1; threads = calloc(sizeof(pthread_t), total_threads); if (unlikely(!threads)) return NULL;