unix,win: look up UV_THREADPOOL_SIZE with uv_os_getenv (#4888)
Use libuv's OS-independent implementation to look up UV_THREADPOOL_SIZE. Fixes: https://github.com/libuv/libuv/issues/4887
This commit is contained in:
parent
47611f7855
commit
271d173b6e
@ -194,11 +194,21 @@ void uv__threadpool_cleanup(void) {
|
||||
static void init_threads(void) {
|
||||
uv_thread_options_t config;
|
||||
unsigned int i;
|
||||
size_t buflen;
|
||||
char buf[16];
|
||||
const char* val;
|
||||
int err;
|
||||
|
||||
uv_sem_t sem;
|
||||
|
||||
nthreads = ARRAY_SIZE(default_threads);
|
||||
val = getenv("UV_THREADPOOL_SIZE");
|
||||
|
||||
buflen = ARRAY_SIZE(buf);
|
||||
err = uv_os_getenv("UV_THREADPOOL_SIZE", buf, &buflen);
|
||||
val = NULL;
|
||||
if (err == 0)
|
||||
val = buf;
|
||||
|
||||
if (val != NULL)
|
||||
nthreads = atoi(val);
|
||||
if (nthreads == 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user