summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/workqueue.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/workqueue.c b/src/common/workqueue.c
index c1bd6d4e8b..ed896d78d0 100644
--- a/src/common/workqueue.c
+++ b/src/common/workqueue.c
@@ -359,12 +359,17 @@ threadpool_queue_update(threadpool_t *pool,
return 0;
}
+/** Don't have more than this many threads per pool. */
+#define MAX_THREADS 1024
+
/** Launch threads until we have <b>n</b>. */
static int
threadpool_start_threads(threadpool_t *pool, int n)
{
if (n < 0)
return -1;
+ if (n > MAX_THREADS)
+ n = MAX_THREADS;
tor_mutex_acquire(&pool->lock);