We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 19f9f4d commit 520e035Copy full SHA for 520e035
include/v.h
@@ -228,6 +228,7 @@ void *v_thread_wait_and_destroy(v_thread *);
228
struct v_threadpool;
229
typedef struct v_threadpool v_threadpool;
230
231
+/* NOTE: n_threads == 0 will default to system ncpu + 1 */
232
v_threadpool *v_threadpool_create(size_t n_threads);
233
void v_threadpool_destroy(v_threadpool *);
234
@@ -839,7 +840,7 @@ static void *v_threadpool_worker(void *arg) {
839
840
841
v_threadpool *v_threadpool_create(size_t n_threads) {
842
if (!n_threads)
- n_threads = 2;
843
+ n_threads = v_sys_get_cores() + 1;
844
struct v_threadpool *pool = calloc(1, sizeof(*pool));
845
pool->alive_threads = n_threads;
846
pool->mutex = v_mutex_create();
0 commit comments