aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tpool.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tpool.c b/src/tpool.c
index 1aa5986..46213ff 100644
--- a/src/tpool.c
+++ b/src/tpool.c
@@ -1,5 +1,7 @@
#include <pthread.h>
#include <stdlib.h>
+#include <sys/sysinfo.h>
+
#include "tpool.h"
struct tpool_work {
@@ -102,8 +104,8 @@ tpool_t *tpool_create(size_t num)
tpool_t *tp;
pthread_t thread;
- if (num == 0)
- num = 12;
+ if (num <= 0)
+ num = get_nprocs();
tp = (tpool_t *)malloc(sizeof(*tp));
tp->thread_cnt = num;