From e77dd1a6845a1a136237ac9996f964b9efaa7e2a Mon Sep 17 00:00:00 2001 From: Frederic-Philippe Metz Date: Thu, 23 Oct 2014 11:00:24 -0400 Subject: [PATCH] create as many threads as cpus --- daemon/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/daemon/main.c b/daemon/main.c index d746cb7db..86802a2ad 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -617,6 +617,7 @@ static void poller_loop(void *d) { int main(int argc, char **argv) { struct main_context ctx; + int idx=0, numCPU=0; options(&argc, &argv); init_everything(); @@ -626,10 +627,12 @@ int main(int argc, char **argv) { thread_create_detach(sighandler, NULL); thread_create_detach(timer_loop, ctx.p); - thread_create_detach(poller_loop, ctx.p); - thread_create_detach(poller_loop, ctx.p); - thread_create_detach(poller_loop, ctx.p); - thread_create_detach(poller_loop, ctx.p); + + numCPU = sysconf( _SC_NPROCESSORS_ONLN ); + + for (;idx