From 054a4953519c81247bf8a8d19e6ce14aa5df914e Mon Sep 17 00:00:00 2001 From: Brandon Cheng Date: Sat, 13 Mar 2021 16:52:10 -0500 Subject: [PATCH] unix: expose thread_stack_size() internally This function will be used by `uv__fsevents_loop_init` in a future commit to determine the initial FSEvents pthread stack size. PR-URL: https://github.com/libuv/libuv/pull/3132 Reviewed-By: Ben Noordhuis Reviewed-By: Santiago Gimeno --- src/unix/internal.h | 1 + src/unix/thread.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/unix/internal.h b/src/unix/internal.h index 3bdf7283..11ff659d 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -261,6 +261,7 @@ void uv__prepare_close(uv_prepare_t* handle); void uv__process_close(uv_process_t* handle); void uv__stream_close(uv_stream_t* handle); void uv__tcp_close(uv_tcp_t* handle); +size_t uv__thread_stack_size(void); void uv__udp_close(uv_udp_t* handle); void uv__udp_finish_close(uv_udp_t* handle); uv_handle_type uv__handle_type(int fd); diff --git a/src/unix/thread.c b/src/unix/thread.c index 1a85d1d4..98fc2e1b 100644 --- a/src/unix/thread.c +++ b/src/unix/thread.c @@ -168,7 +168,7 @@ void uv_barrier_destroy(uv_barrier_t* barrier) { * On Linux, threads created by musl have a much smaller stack than threads * created by glibc (80 vs. 2048 or 4096 kB.) Follow glibc for consistency. */ -static size_t thread_stack_size(void) { +size_t uv__thread_stack_size(void) { #if defined(__APPLE__) || defined(__linux__) struct rlimit lim; @@ -234,7 +234,7 @@ int uv_thread_create_ex(uv_thread_t* tid, attr = NULL; if (stack_size == 0) { - stack_size = thread_stack_size(); + stack_size = uv__thread_stack_size(); } else { pagesize = (size_t)getpagesize(); /* Round up to the nearest page boundary. */