From c3dce38bd812c0c0c747c6c0e80c389505c9cf32 Mon Sep 17 00:00:00 2001 From: marktwtn Date: Mon, 27 May 2019 11:27:07 +0800 Subject: [PATCH] feat: Make dcurl set the threadpool size of libtuv In the initialization phase of dcurl, the threadpool size is preset to the (maximum processor - 1) with the new libtuv API uv_set_threadpool_size(). Then the threadpool would be initialized in the first call of dcurl_entry() with the preset size. Close #149. --- deps/libtuv | 2 +- src/pow_avx.c | 1 + src/pow_c.c | 1 + src/pow_sse.c | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/deps/libtuv b/deps/libtuv index 9cd1daa..4f51adb 160000 --- a/deps/libtuv +++ b/deps/libtuv @@ -1 +1 @@ -Subproject commit 9cd1daaab0b1e491683a271aff582937bb376977 +Subproject commit 4f51adbd57db2aa8a497462cf92f1d08fa8b52fc diff --git a/src/pow_avx.c b/src/pow_avx.c index 25a67f8..1feb72b 100644 --- a/src/pow_avx.c +++ b/src/pow_avx.c @@ -607,6 +607,7 @@ static bool PoWAVX_Context_Initialize(ImplContext *impl_ctx) impl_ctx->bitmap = impl_ctx->bitmap << 1 | 0x1; uv_loop_init(&ctx[i].loop); } + uv_set_threadpool_size(nproc); impl_ctx->context = ctx; uv_mutex_init(&impl_ctx->lock); return true; diff --git a/src/pow_c.c b/src/pow_c.c index 5c44e26..640b659 100644 --- a/src/pow_c.c +++ b/src/pow_c.c @@ -371,6 +371,7 @@ static bool PoWC_Context_Initialize(ImplContext *impl_ctx) impl_ctx->bitmap = impl_ctx->bitmap << 1 | 0x1; uv_loop_init(&ctx[i].loop); } + uv_set_threadpool_size(nproc); impl_ctx->context = ctx; uv_mutex_init(&impl_ctx->lock); return true; diff --git a/src/pow_sse.c b/src/pow_sse.c index b2e77e7..cec30d1 100644 --- a/src/pow_sse.c +++ b/src/pow_sse.c @@ -389,6 +389,7 @@ static bool PoWSSE_Context_Initialize(ImplContext *impl_ctx) impl_ctx->bitmap = impl_ctx->bitmap << 1 | 0x1; uv_loop_init(&ctx[i].loop); } + uv_set_threadpool_size(nproc); impl_ctx->context = ctx; uv_mutex_init(&impl_ctx->lock); return true;